<!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 "hack", 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 "bomberman". 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< ---------------------------</span></font></div>
<div align="left"><font face="Arial" size="2"><span style="font-size:10pt">[sbox-SDK_ARMEL: ~/bomberman-deb] > make</span></font></div>
<div align="left"><font face="Arial" size="2"><span style="font-size:10pt">if gcc -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\"</span></font></div>
<div align="left"><font face="Arial" size="2"><span style="font-size:10pt">-DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE=\"bomberman-
app\"</span></font></div>
<div align="left"><font face="Arial" size="2"><span style="font-size:10pt">-DVERSION=\"0.93\" -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    -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   -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">".deps/bomberman-bomberman.Tpo" \</span></font></div>
<div align="left"><font face="Arial" size="2"><span style="font-size:10pt">  -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 ".deps/bomberman-bomberman.Tpo" ".deps/bomberman-bomberman.Po"; \</span></font></div>
<div align="left"><font face="Arial" size="2"><span style="font-size:10pt">else rm -f ".deps/bomberman-bomberman.Tpo"; 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] ></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 <string.h></span></font></div>
<div align="left"><font face="Arial" size="2"><span style="font-size:10pt">22 #include <stdlib.h></span></font></div>
<div align="left"><font face="Arial" size="2"><span style="font-size:10pt">23 #include <stdio.h></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 <sys/socket.h></span></font></div>
<div align="left"><font face="Arial" size="2"><span style="font-size:10pt">28 #include <sys/types.h></span></font></div>
<div align="left"><font face="Arial" size="2"><span style="font-size:10pt">29 #include <sys/ioctl.h></span></font></div>
<div align="left"><font face="Arial" size="2"><span style="font-size:10pt">30 #include <netinet/in.h></span></font></div>
<div align="left"><font face="Arial" size="2"><span style="font-size:10pt">31 #include <net/if.h></span></font></div>
<div align="left"><font face="Arial" size="2"><span style="font-size:10pt">32 #include <arpa/inet.h></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     struct ifreq ifa;</span></font></div>
<div align="left"><font face="Arial" size="2"><span style="font-size:10pt">75     struct sockaddr_in *i;</span></font></div>
<div align="left"><font face="Arial" size="2"><span style="font-size:10pt">76     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     strcpy (retstr, "error: not available");</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     strcpy (ifa.ifr_name, "eth1"); // 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     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       return(retstr); // Error: return "error: not available"</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     if(ioctl(fd, SIOCGIFADDR, &ifa))</span></font></div>
<div align="left"><font face="Arial" size="2"><span style="font-size:10pt">86       return(retstr); // Error: return "error: not available"</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     i = (struct sockaddr_in*) &ifa.ifr_addr;</span></font></div>
<div align="left"><font face="Arial" size="2"><span style="font-size:10pt">89     strcpy(retstr,inet_ntoa(i->sin_addr));</span></font></div>
<div align="left"><font face="Arial" size="2"><span style="font-size:10pt">90     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     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< ---------------------------</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 <at> rotters <dot> de * www.rotters.de</span></font></div>
</body>
</html>