Yup, I was getting the same error. But you can fix it by setting a
linger time of 0.
After opening a socket I do the following:
NetSocketLingerType linger;
linger.onOff = true;
linger.time = 0;
if
(NetLibSocketOptionSet(AppNetRefnum,mysocket,netSocketOptLevelSocket,
netSocketOptSockLinger,&linger,sizeof(linger),AppNetTimeout,&errno) !=
0)
{
/* error */
}
This fixes the problem.
Chris
Eduardo Thuler wrote:
>
> I'm opening some sockets (around 30) in my program. I have a code that
> worked fine on Palm OS 3.1. In Palm OS 3.5 I can't seem to open the 17th
> socket. The sockets are closed without a problem but they don't seem to be
> released.
> I have tried some different thing in the linger option: I've tried it on and
> off with a small time or with the time 0.
> I set the linger write after opening the socket. Is that right ?
>
> .
> .
> .
> NetSocketLingerType linger;
>
> acceptSock = socket(AF_INET, SOCK_STREAM, 0);
> if (acceptSock < 0)
> {
> goto ExitErr;
> }
>
> linger.onOff = false;
> linger.time = 1;
>
> int iRetornoOpt = setsockopt(acceptSock, netSocketOptLevelSocket,
> netSocketOptSockLinger, (VoidPtr) &linger, sizeof(NetSocketLingerType));
> if(iRetornoOpt != 0)
>
> char msg[300];
> StrPrintF(msg, "Erro set opt %d", iRetornoOpt);
> AddLog(msg);
> }
>
> I get no error in the setsockopt() nor in the socket close.
>
> Any ideas ?
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/