• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Using NSSocketPort, NSConnection, Distributed Objects, and threads...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using NSSocketPort, NSConnection, Distributed Objects, and threads...


  • Subject: Re: Using NSSocketPort, NSConnection, Distributed Objects, and threads...
  • From: Allan Dushan <email@hidden>
  • Date: Tue, 8 Nov 2005 13:53:00 -0800

I knew I forgot to mention one more thing...

What started me down this slope was exactly the solution you are suggesting.

Getting the socket and trying to change the SO_REUSEADDR option on the NSSocketPort, after the initWithTCPPort: call, has no affect. When I use the call to initWithProtocolFamily:socketType:protocol:socket: I get to set up the socket before binding and listening. I am not sure what is going on when I call initWithTCPPort:, but my guess is that the binding and listening occur once this call returns. Can you change the options on a socket once a bind and listen call have been made?

Thanks for the suggestion though,

Allan Dushan


On Nov 8, 2005, at 12:48 PM, Douglas Davidson wrote:


On Nov 8, 2005, at 10:20 AM, Allan Dushan wrote:

I understand that you need to send the message enableMultipleThreads: to your NSConnection to allow threading to be handled correctly, and I do send this message to both the server and client NSConnection objects when I set them up, but... when I manually setup an NSSocketPort using initWithProtocolFamily:socketType:protocol:socket:, enableMutlipleThreads: no longer works. If I use initWithTCPPort:, everything works fine. So you might be asking why then don't I just use initWithTCPPort:? Because, I need to set socket options especially the SO_REUSEADDR option so that I don't have to wait forever to reconnect to a server were the connection was not shut down properly, due to the server crashing or some other issue.


I'm not sure exactly what is going wrong in your case, but you can use initWithTCPPort: and then call -socket to obtain the socket so that you can set SO_REUSEADDR on it.


Douglas Davidson


_______________________________________________ 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
References: 
 >Using NSSocketPort, NSConnection, Distributed Objects, and threads... (From: Allan Dushan <email@hidden>)
 >Re: Using NSSocketPort, NSConnection, Distributed Objects, and threads... (From: Douglas Davidson <email@hidden>)

  • Prev by Date: Re: AppKit source code should be public when...
  • Next by Date: Re: How does Cocoa identify itself to a web server?
  • Previous by thread: Re: Using NSSocketPort, NSConnection, Distributed Objects, and threads...
  • Next by thread: Understanding [NSTextview setInsertionPointColor:]
  • Index(es):
    • Date
    • Thread