Re: Distributed Objects pitfalls and strategies (SOLUTION (?))
Re: Distributed Objects pitfalls and strategies (SOLUTION (?))
- Subject: Re: Distributed Objects pitfalls and strategies (SOLUTION (?))
- From: mmalcolm crawford <email@hidden>
- Date: Wed, 31 Mar 2004 01:13:20 -0800
On Mar 30, 2004, at 5:31 PM, John Scalo wrote:
The key here is to set the SO_REUSEADDR and *not* the SO_REUSEPORT
option. This is what was killing me before. I found other references
suggesting SO_REUSEPORT, but apparently they are wrong. I tried
SO_REUSEADDR on a whim.
In case it might be useful for anyone else, I subsequently saw the
comment in my example:
/*
By default the system does not reuse sockets. This leads to a problem
if the service
is stopped and started quickly in succession. Although the socket is
closed when the
service is stopped, the socket remains "in use" and by default cannot
be reopened.
The following line allows the socket to be reused.
See: "UNIX Network Programming", W. Richard Stevens, p312-320
*/
int value = 1;
setsockopt(fdForListening, SOL_SOCKET, SO_REUSEADDR, &value,
sizeof(int));
Sorry for not thinking about that before. Amazing what you write and
then completely forget about...
mmalc
_______________________________________________
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.