I'm trying to use sysNotifyNetLibIFMediaEvent to inform my application of
when the network is available.  The docs say that
sysNotifyNetLibIFMediaEvent is sent when the network starts or stops, and
one can tell which way the network is going (up or down) by the
NetLibIFMediaEventNotificationTypeEnum enum.

I have successfully implemented code to see the network coming up.  That
works great.  However, I can't seem to get a sysNotifyNetLibIFMediaEvent
when the network goes down.  I'm testing with the Xircom clip-on sled for
the m505 and have stopped the network 3 ways:

1. Pull off the sled
2. Let the network timeout
3. Disconnect in the Network Prefs panel

None of these ways of disconnecting seem to be sending any sort of
sysNotifyNetLibIFMediaEvent, be it netIFMediaUp or netIFMediaDown.  So I
thought I'd try trapping sysExternalConnectorDetachEvent because at the very
least, that would take care of scenario 1 above . . . and it worked.

Then I looked around the NetMgr API and found NetLibOpenCount () which the
docs say is used by the Network preferences panel.  I thought that was odd,
and that the Network Prefs panel probably used this call to know whether to
show a "Connect" or "Disconnect" button, which is the same sort of
functionality I wanted.  My application sets an alarm when the network comes
up and periodically fires a few packets off as long as the network is alive.
So now, when the alarm goes off and my app is ready to do its think in the
background, I first check NetLibOpenCount () and if the count is 0, my app
assumes the network is down, removes any future alarms, and doesn't send its
data.

So in light of these experiments, I have two questions:

#1: Is sysNotifyNetLibIFMediaEvent actually fired when the network goes
down, and if so, what does one need to do to actually see it?

#2: Is my method of using NetLibOpenCount () "The Right Way" to do things?
(Is it how the Network Prefs panel works?)

Have a good weekend :)

-DGA

-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/tech/support/forums/

Reply via email to