On 26-May-99 Ion Popescu wrote:

> I am writing an app that uses NetLib.  After 16 successful connections, my
> app gets "netErrTooManyTCPConnections" (error: 0x124F) from 
> NetLibSocketOpen() call.  The figure 16 gives me a  feeling that I am
> missing an unlock/free of one of the network resources.  I have checked my
> code quite a few times - every execution has the following sequence

That doesn't quite sound like the problem I was having.  I noticed some
flakiness if I called NetLibClose() with false in response to an error on a
NetLibOpen().  AFAIK you are limited to 4 simultaneous sockets.

> Do I need to call NetLibSocketShutdown() before NetLibSocketClose()?

Not that I'm aware of.. in that I've never called it.  But I'm doing a
NetLibClose() after each session so maybe that cleans up any sockets that are
still in the WAIT state.

> NetLibClose is called with "false" as the second argument (as suggested by
> document). I have also checked NetLibOpenCount() at each and every stage -
> it is 0 before I open and '1' while I use NetLib and back to '0' after I
> close it. I can recover from the above error if the interface is
> disconnected  explicitly (either wait for poweroff, "Disconnect" button in
> NW panel or by software). After the line is disconnected, NetLibSocketOpen()
> will work for another 16 turns. (NetLibSocketClose() as well as
> NetLibClose() return success all the time)

I have found through experimentation that if you don't call NetLibClose()
with true after a NetLibOpen() failure that you can end up in a
quasi-connected state whereby you have to power-down the unit before trying
again.  Elsewise, if connection (I mean dial-up) is successful you should
call NetLibClose() with a false so that the connection can stay open for
other applications.  Also if you don't check for launchChr, menuChr,
hardPowerChr in your EventLoop() and shutdown the network you can wind up in
this trouble as well.. especially since OS 2 uses a pop-up for the launcher
which means that your application is still running when you push the
application button.

Not sure if it will help but you are welcome to the source of GNUGotMail:

http://www.america.com/~chrisf/web/pilot/pilot.html


/* Chris Faherty <[EMAIL PROTECTED]>, finger for PGP */

Reply via email to