It's not very nice to close it if the other app thinks it's open...

-----Original Message-----
From: Matt Hebley [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, July 31, 2002 10:37 PM
To: Palm Developer Forum
Subject: Re: Closing the NetLib


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/


------------------------------------------

The information in this transmittal and any attachments is privileged and confidential 
and is intended only for the recipient(s) listed above. You are hereby notified that 
any unauthorized distribution or copying of this transmittal or its attachments is 
prohibited. If you have received this transmittal in error, please notify Invivodata 
immediately at (831) 438-9550.

------------------------------------------



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

Reply via email to