Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Distributed Objects pitfalls and strategies (SOLUTION (?))



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.


References: 
 >Distributed Objects pitfalls and strategies (From: John Scalo <email@hidden>)
 >Re: Distributed Objects pitfalls and strategies (From: Aurélien Hugelé <email@hidden>)
 >Re: Distributed Objects pitfalls and strategies (SOLUTION (?)) (From: John Scalo <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.