At 11:12 PM -0500 2000/01/17, Chris Faherty wrote:
>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?
It's all terribly confusing if you ask me... but you'll want to "linger for 0 seconds"
like this:
ltype.onOff = true;
ltype.time = 0;
Our IP stack source goes something like this:
if ( socketP->linger.onOff && socketP->linger.time == 0 )
...do an abortive close
As for why a 10 second "pause" is needed between closing a socket and opening another
one, well, I'm not certain. The IP stack is running as a background task in the OS,
and non-blocking mailbox messaging queues are used exclusively for communication with
that task, so this could be a limitation involving the kernel's ability to grant
sufficient execution time to the stack when your application is in such a tight loop,
opening and closing sockets.
Fundamentally, the Palm OS' IP stack wasn't really designed to support this type of
high-volume open/close usage. It was originally intended for HotSync opening a single
socket and maximizing data transfer performance. I realize that doesn't solve your
problem, but it may help explain why our flat blade screwdriver keep stripping your
Phillips head screws...
Regards,
Jim Schram
3Com/Palm Computing
Partner Engineering