Logged in as Guest   Sun, Oct. 21st, 7:25 AM.      
 
 
Web hazelware.luggle.com
 

Inspecting Network Connection Settings On The PalmOS
Sometimes, you need to know a bit about the connection that you've established with NetLibOpen, especially if it was established with DHCP. Perhaps you need to do some debugging of the DNS server, or perhaps you need to see what gateway your application actually connected to. Even more likely, you might need to know what IP address your device was assigned. You might use this address to establish a P2P service or a multiplayer game connection. There are many reasons why your application might need to do this, but I'm sure you can come up with your own ideas as well.
All of these settings can be found in NetMgr.h, but for the sake of simplicity, I present the settings that I have found invaluable when trying to debug network connectivity issues:

UInt32 dhcpPPPAddress;
UInt32 subnetMask;
UInt32 serverPPPAddress;
UInt32 primaryDNS;
UInt32 secondaryDNS;
UInt16 size = sizeof(UInt32);

//This will return the IP address of the gateway server that 
//was assigned to the device...
Err err = NetLibSettingGet(netLibRef, 
                           netIFSettingServerIPAddr, 
                           &serverPPPAddress, 
                           &size);

//This will return the IP address that was assigned to the 
//device itself...
err = NetLibSettingGet(netLibRef, 
                       netIFSettingActualIPAddr,  
                       &dhcpPPPAddress, 
                       &size);

//This will return the subnet mask that was assigned to the 
//device itself...
err = NetLibSettingGet(netLibRef, 
                       netIFSettingSubnetMask, 
                       &subnetMask, 
                       &size);

//This will return the IP address of the primary DNS server 
//that was assigned to the device...
err = NetLibSettingGet(netLibRef, 
                       netSettingRTPrimaryDNS, 
                       &primaryDNS, 
                       &size);

//This will return the IP address of the secondary DNS 
//server that was assigned to the device...
err = NetLibSettingGet(netLibRef, 
                       netSettingRTSecondaryDNS, 
                       &secondaryDNS, 
                       &size);


As usual, this code is presented as-is, but if you find it helpful, I always like to know.

-Jon
Submitted by bosshogg on Wednesday the 31st 1970f December 1969, at 04:00

 
Recent Entries:
I'm BACK!!!!!!
Code Monkey
Cool 3D Code Snippet From My Former Life
YouTube: The Revival of the Internet Time Killer
WhereMate Released
Palmasaurus Released As Freeware
VM-Plus Beta
Handspring Undocumented APIs
Posting Malaise
PhoneShield Released!!!

Archive:
October - 2007
August - 2007
July - 2007
June - 2007
May - 2007
April - 2007
December - 2006
November - 2006
September - 2006
August - 2006
July - 2006
March - 2006
February - 2006
January - 2006
December - 2005
November - 2005
October - 2005
September - 2005
August - 2005
July - 2005
June - 2005
May - 2005
April - 2005
February - 2005
January - 2005
December - 2004
November - 2004
October - 2004
September - 2004
August - 2004
July - 2004
June - 2004
May - 2004
April - 2004
March - 2004