I'm not sure if this is what you are asking for, but...
To get your local IP address, use something like this:
NetLibSettingGet(m_nNetRefnum, netIFSettingActualIPAddr,
&dhcpPPPAddress,&size);
To get the IP address of your gateway, use something like this:
NetLibSettingGet(m_nNetRefnum, netIFSettingServerIPAddr,
&serverPPPAddress, &size);
Hope this helps!
-Jon
-------------------------------------------
Jonathan Hays
Palm OS Certified Developer
http://hazelware.luggle.com
-------------------------------------------
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of versha khar
Sent: Thursday, March 17, 2005 4:59 AM
To: Palm Developer Forum
Subject: problem with NetLibSocketAddr , NetLibArrrINToA
Hi all,
In my network application I am trying to get the IP address of my local host
and remote host by function - NetLibSocketAddr . i am using NetMgr.h ,trying
my application on Simulato5.0 using codewarrior8.0 .getting an error..... , but
cant figure out my problem.kindly help!
Thanks
Heres my bit of code :
*************************************************
Int16 *l1,*l2;
NetSocketAddrINType destAddr, locAddr ;
NetHostInfoBufPtr hostInfoBufP;
NetIPAddr *IPaddressP;
Int32 AppNetTimeout ;
Err error;
MemSet(&destAddr, sizeof(destAddr), 0);
destAddr.family = netSocketAddrINET;
destAddr.port = 80;
hostInfoBufP =
(NetHostInfoBufPtr) MemPtrNew (sizeof (NetHostInfoBufType));
hostInfoP = NetLibGetHostByName(AppNetRefnum,"www.xyzl.com",hostInfoBufP,
AppNetTimeout, &error); //dummy URL
if(hostInfoP !=0)//no error
{
IPaddressP = (NetIPAddr*)hostInfoBufP->addressList[0];
destAddr.addr = NetNToHL(*IPaddressP);
// FldInsert(fldptr1, "gethostbyname successful ", 25);
}
MemSet(&locAddr, sizeof(locAddr), 0);
/*i ger error here----------have i assigned something wrong here*/
*l1 =sizeof(locAddr);
*l2 =sizeof(destAddr);
result = NetLibSocketAddr(AppNetRefnum,socket , (NetSocketAddrType*)&locAddr,l1
,(NetSocketAddrType *)&destAddr ,l2, -1, &error);
--
For information on using the Palm Developer Forums, or to unsubscribe, please
see http://www.palmos.com/dev/support/forums/
--
For information on using the Palm Developer Forums, or to unsubscribe, please
see http://www.palmos.com/dev/support/forums/