<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html  xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><head>
<title></title>
<meta http-equiv="content-type" content="text/html;charset=utf-8"/>
<meta http-equiv="Content-Style-Type" content="text/css"/>
</head>
<body>
<div align="left"><font face="Arial" size="2"><span style="font-size:10pt">Hello,</span></font></div>
<div align="left"><font face="Arial" size="2"><span style="font-size:10pt"><br />
</span></font></div>
<div align="left"><font face="Arial" size="2"><span style="font-size:10pt">I am working on a network game. To connect to the server, I have to find out</span></font></div>
<div align="left"><font face="Arial" size="2"><span style="font-size:10pt">the IP Adress of the 770's WLAN Interface. When I compile the code direct in</span></font></div>
<div align="left"><font face="Arial" size="2"><span style="font-size:10pt">the SDK (2.1), it compiles without problems. When I use the the</span></font></div>
<div align="left"><font face="Arial" size="2"><span style="font-size:10pt">automake/conf'd version, it breaks during compiling with the error:</span></font></div>
<div align="left"><font face="Arial" size="2"><span style="font-size:10pt"><br />
</span></font></div>
<div align="left"><font face="Arial" size="2"><span style="font-size:10pt">bomberman.c:74: error: storage size of 'ifa' isn't known</span></font></div>
<div align="left"><font face="Arial" size="2"><span style="font-size:10pt"><br />
</span></font></div>
<div align="left"><font face="Arial" size="2"><span style="font-size:10pt">I think it is because of the defines created by automake/conf. But I have no</span></font></div>
<div align="left"><font face="Arial" size="2"><span style="font-size:10pt">idea what breaks.</span></font></div>
<div align="left"><font face="Arial" size="2"><span style="font-size:10pt">I did a &quot;hack&quot;, compiled it without the ifa struct and created a beta package. </span></font></div>
<div align="left"><font face="Arial" size="2"><span style="font-size:10pt">Anyone who is interessted may look under www.rotters.de, it's </span></font></div>
<div align="left"><font face="Arial" size="2"><span style="font-size:10pt">called &quot;bomberman&quot;. I am interessted if someone could test it with multiple </span></font></div>
<div align="left"><font face="Arial" size="2"><span style="font-size:10pt">N770 in a real network game!</span></font></div>
<div align="left"><font face="Arial" size="2"><span style="font-size:10pt"><br />
</span></font></div>
<div align="left"><font face="Arial" size="2"><span style="font-size:10pt">Thanks for any help,</span></font></div>
<div align="left"><font face="Arial" size="2"><span style="font-size:10pt"><br />
</span></font></div>
<div align="left"><font face="Arial" size="2"><span style="font-size:10pt">-Klaus</span></font></div>
<div align="left"><font face="Arial" size="2"><span style="font-size:10pt"><br />
</span></font></div>
<div align="left"><font face="Arial" size="2"><span style="font-size:10pt">-------------------------- 8&lt; ---------------------------</span></font></div>
<div align="left"><font face="Arial" size="2"><span style="font-size:10pt">[sbox-SDK_ARMEL: ~/bomberman-deb] &gt; make</span></font></div>
<div align="left"><font face="Arial" size="2"><span style="font-size:10pt">if gcc -DPACKAGE_NAME=\&quot;\&quot; -DPACKAGE_TARNAME=\&quot;\&quot; -DPACKAGE_VERSION=\&quot;\&quot;</span></font></div>
<div align="left"><font face="Arial" size="2"><span style="font-size:10pt">-DPACKAGE_STRING=\&quot;\&quot; -DPACKAGE_BUGREPORT=\&quot;\&quot; -DPACKAGE=\&quot;bomberman-
app\&quot;</span></font></div>
<div align="left"><font face="Arial" size="2"><span style="font-size:10pt">-DVERSION=\&quot;0.93\&quot; -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -
DHAVE_SYS_STAT_H=1</span></font></div>
<div align="left"><font face="Arial" size="2"><span style="font-size:10pt">-DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -
DHAVE_STRINGS_H=1</span></font></div>
<div align="left"><font face="Arial" size="2"><span style="font-size:10pt">-DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -
DHAVE_DLFCN_H=1</span></font></div>
<div align="left"><font face="Arial" size="2"><span style="font-size:10pt">-I. -I/home/klaus/bomberman-deb&#160;&#160;&#160; -D_XOPEN_SOURCE=500 -DXTHREADS</span></font></div>
<div align="left"><font face="Arial" size="2"><span style="font-size:10pt">-DXUSE_MTSAFE_API -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include</span></font></div>
<div align="left"><font face="Arial" size="2"><span style="font-size:10pt">-I/usr/X11R6/include -I/usr/include/atk-1.0 -I/usr/include/pango-1.0</span></font></div>
<div align="left"><font face="Arial" size="2"><span style="font-size:10pt">-I/usr/include/freetype2 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include</span></font></div>
<div align="left"><font face="Arial" size="2"><span style="font-size:10pt">-I/usr/include/dbus-1.0 -I/usr/lib/dbus-1.0/include -I/usr/include/glib-2.0</span></font></div>
<div align="left"><font face="Arial" size="2"><span style="font-size:10pt">-I/usr/lib/glib-2.0/include&#160;&#160; -g -O2 -MT bomberman-bomberman.o -MD -MP -MF</span></font></div>
<div align="left"><font face="Arial" size="2"><span style="font-size:10pt">&quot;.deps/bomberman-bomberman.Tpo&quot; \</span></font></div>
<div align="left"><font face="Arial" size="2"><span style="font-size:10pt">&#160; -c -o bomberman-bomberman.o est -f 'bomberman.c' || echo</span></font></div>
<div align="left"><font face="Arial" size="2"><span style="font-size:10pt">'/home/klaus/bomberman-deb/'omberman.c; \</span></font></div>
<div align="left"><font face="Arial" size="2"><span style="font-size:10pt">then mv -f &quot;.deps/bomberman-bomberman.Tpo&quot; &quot;.deps/bomberman-bomberman.Po&quot;; \</span></font></div>
<div align="left"><font face="Arial" size="2"><span style="font-size:10pt">else rm -f &quot;.deps/bomberman-bomberman.Tpo&quot;; exit 1; \</span></font></div>
<div align="left"><font face="Arial" size="2"><span style="font-size:10pt">fi</span></font></div>
<div align="left"><font face="Arial" size="2"><span style="font-size:10pt">bomberman.c: In function get_ip_addr':</span></font></div>
<div align="left"><font face="Arial" size="2"><span style="font-size:10pt">bomberman.c:74: error: storage size of 'ifa' isn't known</span></font></div>
<div align="left"><font face="Arial" size="2"><span style="font-size:10pt">make: *** [bomberman-bomberman.o] Error 1</span></font></div>
<div align="left"><font face="Arial" size="2"><span style="font-size:10pt">[sbox-SDK_ARMEL: ~/bomberman-deb] &gt;</span></font></div>
<div align="left"><font face="Arial" size="2"><span style="font-size:10pt"><br />
</span></font></div>
<div align="left"><font face="Arial" size="2"><span style="font-size:10pt">Parts of the source code:</span></font></div>
<div align="left"><font face="Arial" size="2"><span style="font-size:10pt"><br />
</span></font></div>
<div align="left"><font face="Arial" size="2"><span style="font-size:10pt">...</span></font></div>
<div align="left"><font face="Arial" size="2"><span style="font-size:10pt">21 #include &lt;string.h&gt;</span></font></div>
<div align="left"><font face="Arial" size="2"><span style="font-size:10pt">22 #include &lt;stdlib.h&gt;</span></font></div>
<div align="left"><font face="Arial" size="2"><span style="font-size:10pt">23 #include &lt;stdio.h&gt;</span></font></div>
<div align="left"><font face="Arial" size="2"><span style="font-size:10pt">24 </span></font></div>
<div align="left"><font face="Arial" size="2"><span style="font-size:10pt">25 // To get IP Adress</span></font></div>
<div align="left"><font face="Arial" size="2"><span style="font-size:10pt">26 </span></font></div>
<div align="left"><font face="Arial" size="2"><span style="font-size:10pt">27 #include &lt;sys/socket.h&gt;</span></font></div>
<div align="left"><font face="Arial" size="2"><span style="font-size:10pt">28 #include &lt;sys/types.h&gt;</span></font></div>
<div align="left"><font face="Arial" size="2"><span style="font-size:10pt">29 #include &lt;sys/ioctl.h&gt;</span></font></div>
<div align="left"><font face="Arial" size="2"><span style="font-size:10pt">30 #include &lt;netinet/in.h&gt;</span></font></div>
<div align="left"><font face="Arial" size="2"><span style="font-size:10pt">31 #include &lt;net/if.h&gt;</span></font></div>
<div align="left"><font face="Arial" size="2"><span style="font-size:10pt">32 #include &lt;arpa/inet.h&gt;</span></font></div>
<div align="left"><font face="Arial" size="2"><span style="font-size:10pt">...</span></font></div>
<div align="left"><font face="Arial" size="2"><span style="font-size:10pt">72 char *get_ip_addr(void)</span></font></div>
<div align="left"><font face="Arial" size="2"><span style="font-size:10pt">73 {</span></font></div>
<div align="left"><font face="Arial" size="2"><span style="font-size:10pt">74&#160;&#160;&#160;&#160; struct ifreq ifa;</span></font></div>
<div align="left"><font face="Arial" size="2"><span style="font-size:10pt">75&#160;&#160;&#160;&#160; struct sockaddr_in *i;</span></font></div>
<div align="left"><font face="Arial" size="2"><span style="font-size:10pt">76&#160;&#160;&#160;&#160; int fd;</span></font></div>
<div align="left"><font face="Arial" size="2"><span style="font-size:10pt">77 </span></font></div>
<div align="left"><font face="Arial" size="2"><span style="font-size:10pt">78&#160;&#160;&#160;&#160; strcpy (retstr, &quot;error: not available&quot;);</span></font></div>
<div align="left"><font face="Arial" size="2"><span style="font-size:10pt">79</span></font></div>
<div align="left"><font face="Arial" size="2"><span style="font-size:10pt">80&#160;&#160;&#160;&#160; strcpy (ifa.ifr_name, &quot;eth1&quot;); // For Nokia 770, use wlan0</span></font></div>
<div align="left"><font face="Arial" size="2"><span style="font-size:10pt">81 </span></font></div>
<div align="left"><font face="Arial" size="2"><span style="font-size:10pt">82&#160;&#160;&#160;&#160; if((fd = socket(AF_INET, SOCK_DGRAM, 0)) == -1)</span></font></div>
<div align="left"><font face="Arial" size="2"><span style="font-size:10pt">83&#160;&#160;&#160;&#160;&#160;&#160; return(retstr); // Error: return &quot;error: not available&quot;</span></font></div>
<div align="left"><font face="Arial" size="2"><span style="font-size:10pt">84</span></font></div>
<div align="left"><font face="Arial" size="2"><span style="font-size:10pt">85&#160;&#160;&#160;&#160; if(ioctl(fd, SIOCGIFADDR, &amp;ifa))</span></font></div>
<div align="left"><font face="Arial" size="2"><span style="font-size:10pt">86&#160;&#160;&#160;&#160;&#160;&#160; return(retstr); // Error: return &quot;error: not available&quot;</span></font></div>
<div align="left"><font face="Arial" size="2"><span style="font-size:10pt">87 </span></font></div>
<div align="left"><font face="Arial" size="2"><span style="font-size:10pt">88&#160;&#160;&#160;&#160; i = (struct sockaddr_in*) &amp;ifa.ifr_addr;</span></font></div>
<div align="left"><font face="Arial" size="2"><span style="font-size:10pt">89&#160;&#160;&#160;&#160; strcpy(retstr,inet_ntoa(i-&gt;sin_addr));</span></font></div>
<div align="left"><font face="Arial" size="2"><span style="font-size:10pt">90&#160;&#160;&#160;&#160; close (fd);</span></font></div>
<div align="left"><font face="Arial" size="2"><span style="font-size:10pt">91 </span></font></div>
<div align="left"><font face="Arial" size="2"><span style="font-size:10pt">92&#160;&#160;&#160;&#160; return (retstr);</span></font></div>
<div align="left"><font face="Arial" size="2"><span style="font-size:10pt">93 }</span></font></div>
<div align="left"><font face="Arial" size="2"><span style="font-size:10pt">-------------------------- 8&lt; ---------------------------</span></font></div>
<div align="left"><font face="Arial" size="2"><span style="font-size:10pt"><br />
</span></font></div>
<div align="left"><font face="Arial" size="2"><span style="font-size:10pt">-- </span></font></div>
<div align="left"><font face="Arial" size="2"><span style="font-size:10pt"> Klaus Rotter * klaus &lt;at&gt; rotters &lt;dot&gt; de * www.rotters.de</span></font></div>
</body>
</html>