Re: A intractable socket bind problem.
Re: A intractable socket bind problem.
- Subject: Re: A intractable socket bind problem.
- From: John Labovitz <email@hidden>
- Date: Mon, 14 Feb 2005 04:26:45 -0800
On Feb 14, 2005, at 1:07 AM, jacky.zhu wrote:
ret = setsockopt( mListen, SOL_SOCKET, SO_REUSEADDR, (char*)&sockOpt,
sizeof(sockOpt) );
and the first process has already closed its listening socket,
the second process can't bind its socket to the address and port until
about a minute later .
(This really isn't a Cocoa question. It's pure BSD/POSIX.)
Try setting the SO_LINGER flag. That will reduce the time needed to
clean up after a close if data is still waiting to be sent. (However,
you may lose data.) I notice also that there's an SO_REUSEPORT option;
perhaps you need that as well as SO_REUSEADDR.
You might also look into file-descriptor passing so you don't have to
close & reopen the socket.
--
John Labovitz
Macintosh support, research, and software development
John Labovitz Consulting, LLC
email@hidden | +1 503.949.3492 |
www.johnlabovitz.com/consulting
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden