Figured it out - almost....

NetLibFinishCloseWait will bring the connection down if the other
application has left it open. It is just that I hadn't figured out that this
was the scenario I was in... (Still can't figure out whether it is in this
state on OS 3.5, but don't need to anyway!)

Matt

----- Original Message -----
From: "Matt Hebley" <[EMAIL PROTECTED]>
To: "Palm Developer Forum" <[EMAIL PROTECTED]>
Sent: Thursday, August 01, 2002 2:32 PM
Subject: Closing the NetLib


> Does anyone know how to close the NetLib if it is opened by another
> application? In other words, how do I detect whether a network connection
is
> currently made?
>
> The way I see it, calls to NetLibOpenCount and NetLibClose only work after
a
> call to NetLibOpen. However, a call to NetLibOpen will try to connect if
> there isn't already a connection. So if I don't want to open a connection,
> just close it, I can't find out whether it is open, nor close it, without
> risking opening it.
>
> In OS 4.0 there is a sysNotifyNetLibIFMediaEvent, but how is this done in
> pre-OS4.0?
>
>
> Here is code that will do what the comments say if there is a connection
> established by another app, but NetLibOpen has not been called by this app
> since it started. (It works fine after a call to NetLibOpen.)
>
>
>     // OK. Returns 0 and ref is set to 4.
>     err = SysLibFind(comLibName, &netlibRefnum);
>
>     if (!err) {
>         // Returns 0, but count is set to 0.
>         err = NetLibOpenCount(netlibRefnum, &count);
>
>         for (i = 0; i < count; i++) {
>             err = NetLibClose(netlibRefnum, true);
>         }
>     }
>
>
> Matt
>
>
>
> --
> 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/

Reply via email to