Przemek:
2010-02-20 18:05 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
TODDO: sync names of lang and corresponding code modules.
TODDO ?
* harbour/src/rtl/hbsocket.c
Please test this code with OS2 using OpenWatcom and GCC (old and
new socket API). I enabled HB_HAS_SOCKADDR_SA_LEN in OS2 builds.
OpenWatocm OS2 header files have such fields but I do know if it's
also present in GCC socket API.
How to test ? code sample
* harbour/src/rtl/hbinet.c
+ added new PRG function:
hb_inetIfInfo( [<lNoAliases>] [, <nAddrFamily>] ) -> <aInfo>
<lNoAliases> is .F. by default so aliases are included
<nAddrFamily> is HB_SOCKET_AF_INET by default
<aInfo> is an array in which each entry is also array with the
following fields:
HB_SOCKET_IFINFO_FAMILY 1 // adress family
HB_SOCKET_IFINFO_NAME 2 // interface name
HB_SOCKET_IFINFO_FLAGS 3 // flags HB_SOCKET_IFF_*
HB_SOCKET_IFINFO_ADDR 4 // interface address
HB_SOCKET_IFINFO_NETMASK 5 // subnetmask
HB_SOCKET_IFINFO_BROADCAST 6 // broadcast address
HB_SOCKET_IFINFO_P2PADDR 7 // point-to-point address
HB_SOCKET_IFINFO_HWADDR 8 // hardware address
Please use this code on different non MS-Windows platforms:
proc main( noAlias )
local iface
? os(), version()
? "interfaces:"
for each iface in hb_inetIfInfo( !empty( noAlias ), 0 )
? hb_valToExp( iface )
next
?
return
and check if it returns correct information about available
interfaces.
Added hb_compiler()
This computer have two network cards
[E:\]ifconfig lan0
lan0: flags=8843<UP,BROADCAST,RUNNING,MULTICAST,LOOPBRD>
inet 192.168.1.110 netmask 0xffffff00 broadcast 192.168.1.255
[E:\]ifconfig lan1
lan1: flags=8843<UP,BROADCAST,RUNNING,MULTICAST,LOOPBRD>
inet 192.168.2.64 netmask 0xffffff00 broadcast 192.168.2.255
OpenWatcom
==========
OS/2 4.50 Harbour 2.1.0dev (Rev. 13944) Open Watcom C 12.80 (32-bit)
interfaces:
{18, "lan0", 19, NIL, NIL, NIL, NIL, NIL}
{2, "lan0", 19, "192.168.1.110", "255.255.255.0", "192.168.1.255", NIL, NIL}
{18, "lan1", 19, NIL, NIL, NIL, NIL, NIL}
{2, "lan1", 19, "192.168.2.64", "255.255.255.0", "192.168.2.255", NIL, NIL}
{18, "lo", 21, NIL, NIL, NIL, NIL, NIL}
{2, "lo", 21, "127.0.0.1", "255.0.0.0", NIL, NIL, NIL}
os2gcc442, with -DTCPV40HDRS
=======================
gcc -I. -I../../../../../include -Zomf -Wall -W -O3
-DHB_LEGACY_TYPES_OFF -DHB_HAS_PCRE
-IE:/harbour102/harbour/external/pcre -DPCRE_STATIC -DHB_HAS_ZLIB
-IE:/harbour102/harbour/external/zlib -DTCPV40HDRS
-DHB_FM_STATISTICS_OFF -ohbsocket.o -c ../../../hbsocket.c
../../../hbsocket.c: In function 'hb_socketGetIFaces':
../../../hbsocket.c:3031: error: 'struct sockaddr' has no member named
'sa_len'
make[3]: *** [hbsocket.o] Error 1
make[3]: Leaving directory `E:/harbour102/harbour/src/rtl/obj/os2/gccomf'
os2gcc442, without -DTCPV40HDRS
=======================
OS/2 4.50 Harbour 2.1.0dev (Rev. 13944) EMX GNU C 4.4.2 (32-bit)
interfaces:
{18, "lan0", 19, NIL, NIL, NIL, NIL, NIL}
{2, "lan0", 19, "192.168.1.110", "255.255.255.0", "192.168.1.255", NIL, NIL}
{18, "lan1", 19, NIL, NIL, NIL, NIL, NIL}
{2, "lan1", 19, "192.168.2.64", "255.255.255.0", "192.168.2.255", NIL, NIL}
{18, "lo", 21, NIL, NIL, NIL, NIL, NIL}
{2, "lo", 21, "127.0.0.1", "255.0.0.0", NIL, NIL, NIL}
David Macias
_______________________________________________
Harbour mailing list (attachment size limit: 40KB)
[email protected]
http://lists.harbour-project.org/mailman/listinfo/harbour