On 18-Jan-00 Jim Schram wrote:
> Well, it's not really "broken" per se... but it is an annoyance.
>
> Closed sockets conventionally stick around for a few minutes to complete
> the last transfer of data pending (if any, in either direction) before the
> socket is closed. These "lingering" connections require memory and
> resources which are extremely limited on a Palm OS device, which has a
> hard-coded limitation of 4 simultaneously active sockets. A lingering
> socket is an active socket as far as the IP stack is concerned.
>
> Setting the SO_LINGER option to 0 is the correct work-around, but may have
> an unavoidable side-effect of closing the socket too abruptly for the other
> end of the connection. The other end may see the close as an "error" as
> opposed to a "normal" socket close, which may or may not have reliably
> completed the last data transfer transaction. YMMV.
Yes, but the problem we are experiencing is that the socket is never reusable
unless you put a SysTaskDelay() of 10 seconds or more between a shutdown and
a close. If you simply turn the lingering off and then do a close, it will
never work again even if you let it linger for 20 minutes or longer. Unless
we are not properly turning SO_LINGER off or something.
This is what Alexander says:
NetSocketLingerType ltype;
ltype.onOff = true;
ltype.time = 0;
retVal = NetLibSocketOptionSet(AppNetRefnum, sock,
netSocketOptLevelSocket, netSocketOptSockLinger,
<ype, sizeof(ltype), -1, &err);
But, I was using this:
ltype.onOff = 0;
ltype.time = 0;
So to turn SO_LINGER off is it onOff = true or onOff = false?
/* Chris Faherty <[EMAIL PROTECTED]> */