There is a function called NetLibMaster to retrieve network statistics, interface statistics etc. There u can check if the PPP interface is up or not. Hope this solves ur problem. Do tell me if this method works.
Regards Sachin "Avilla, Dane" <[EMAIL PROTECTED]> wrote in message news:71206@palm-dev-forum... > > I'm trying to detect a network connection without changing the state of the > network. For example, my application sets an alarm when the network is > activated, and when the alarm goes off, my app wants to see if the network > is open, without actually opening the network if it is closed. This seems > to be a much more difficult proposition than I first expected. > > From what I can tell, the state of NetLib is separate from the state of the > actual network connection. So the network can actually be "up" but > NetLibOpenCount() will return 0. I can only assume this is due to the > Network services running in a separate task which communicates with the user > task thru NetLib, so NetLib maintains its state separately from . > > I've looked on the forum, and several people have asked how to detect the > network connection, and there haven't been many replies. Those who do > reply, say "use NetLibOpenCount()" and as I've found, that isn't reliable, > because NetLibOpenCount == 0 if no apps are actively using the network > connection (ie no apps have called NetLibOpen() without a corresponding > NetLibClose() call). > > So, enter the "hack" (shudder). When the system (using OS 4.0) sends out > notification that the network connection has come up, my app calls > NetLibOpen() so that NetLibOpenCount() will be guaranteed to be > 0. Then, > when my app's alarm is triggered, my app calls NetLibClose(). If > NetLibClose() returns netErrNotOpen, my app knows that the network is no > longer open (and yes, if NetLibClose() returns a valid code--errNone or > netErrStillOpen--the app calls NetLibOpen() again, to maintain the open > count :P). > > So this works fine. I can tell when the network is open or closed . . . > unless, of course, the network fails to actually come up the first time :-/ > If I open the network from the Network Prefs, but the network fails to > actually come up, it seems that the OS is still sending out the "network up" > notification, and there is no way to actually verify if bringing up the > network actually succeeded or whether it failed. > > Anyone have any ideas here? > > Thanks, > > -DGA > > -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/tech/support/forums/
