Re: Making an NSConnection from a BSD socket
Re: Making an NSConnection from a BSD socket
- Subject: Re: Making an NSConnection from a BSD socket
- From: Douglas Davidson <email@hidden>
- Date: Thu, 25 Mar 2004 18:24:10 -0800
On Mar 25, 2004, at 5:39 PM, John Scalo wrote:
I need to set some options on a BSD socket via setsockopt before
binding it (otherwise setsockopt has no effect). I then want to use
this socket to create an NSConnection. Is there any way to create an
NSConnection from a BSD socket rather than an NSSocketPort? Or some
way to turn a raw BSD socket into an NSSocketPort after it's created
via socket() but before bind() ? The problem with using NSSocketPorts
is that when you initialize them, they also get bound so there's no
chance to set any socket options.
BTW, the option I'm setting is SO_REUSEPORT so that if the process
dies with an active connection, it won't take 10 minutes before a new
process can create a new connection with the same port #. It sure
would be nice if NSSocketPort had an initWithTCPPort: options: method!
NSSocketPort has an initWithProtocolFamily:socketType:protocol:socket:
method. That should qualify as a "way to turn a raw BSD socket into an
NSSocketPort".
Douglas Davidson
_______________________________________________
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.