Re: NSConnection via NSSocketPort
Re: NSConnection via NSSocketPort
- Subject: Re: NSConnection via NSSocketPort
- From: Cameron Hayne <email@hidden>
- Date: Fri, 14 Jun 2002 13:57:58 -0400
John Anderson <email@hidden> wrote:
I've got a client server solution that uses NSSocketPort-based
NSConnections to connect clients and servers over TCP/IP. All is fine
and dandy except that sometimes, when I quit and restart my server
application quickly, I can't set aside a port.
While I wouldn't have recognized it from the error messages you got, the
problem you described is a common one in socket programming. The socket
stays busy for a certain time after it is closed in case there is still
some data coming in that was delayed in transit. You can read about this
on the UNIX Socket FAQ page at:
http://www.developerweb.net/sock-faq/
It is explained (in probably too much detail) in the answer to the
question "Please explain the TIME_WAIT state".
One possible solution is via the socket option SO_REUSEADDR. (See the
question "What exactly does SO_REUSEADDR do?"
... Cameron
--
Cameron Hayne (email@hidden)
Hayne of Tintagel
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.