Re: NSSocketPort with NSConnection causing firewall pop-up
Re: NSSocketPort with NSConnection causing firewall pop-up
- Subject: Re: NSSocketPort with NSConnection causing firewall pop-up
- From: Tim Murison <email@hidden>
- Date: Mon, 09 Feb 2009 13:24:43 -0500
- Thread-topic: NSSocketPort with NSConnection causing firewall pop-up
>> Since UDSs are bidirectional, I don't need an explicit receivePort. The
>> documentation for NSConnection states that if receivePort is nil, then a
>> port of the same type as sendPort will be automatically created. My guess is
>> that this is done to provide support for distributed objects over
>> NSMachPorts (as they are unidirectional).
>
> Read further:
> "If sendPort is nil or if both ports are the same, the NSConnection
> object uses receivePort for both sending and receiving and is useful
> only for vending an object."
In my case, sendPort is not nil, only receivePort is. In this case the
documentation fragment I posted applies. For completeness sake, here it is
again:
"If receivePort is nil, the NSConnection object allocates and uses a new
port of the same class as sendPort."
> Just because sockets are bidirectional does not mean that you can get
> by with only one port. This is an issue I ran into a while ago.
>
If I were writing my own networking code, I wouldn't need to create 2
sockets.
> You said above that you want to use UNIX domain sockets... so why are
> you talking about TCP? Shouldn't you be using
> -initWithProtocolFamily:socketType:protocol:address: ?
This is what I am doing. I guess my original e-mail was not clear.
When I do:
[NSConnection connectionWithReceivePort:nil sendPort:sendPort];
sendPort is an NSSocketPort initialized with initWithProtocolFamily:AF_UNIX
socketType: SOCK_STREAM protocol: 0 address: [an NSData with sockaddr_un
copied into it]
Like I said before this works perfectly. My issue is not with the Unix
Domain Socket port, but rather with the receivePort created automatically by
NSConnection as per the documentation fragment I posted.
When NSConnection automatically creates the receivePort, it does something
like:
[[[NSSocketPort alloc] init] autorelease];
[NSSocketPort init] seems to be setting up a socket that listens for
connections from INADDR_ANY on a random port. What I'm asking is, is this
expected/sensible behaviour? It seems to me, [NSSocketPort init] should be
listening on localhost, by default.
-Tim
***********************************************************************
This e-mail and its attachments are confidential, legally privileged, may be subject to copyright and sent solely for the attention of the addressee(s).
Any unauthorized use or disclosure is prohibited. Statements and opinions expressed in this e-mail may not represent those of Radialpoint.
Le contenu de ce courriel est confidentiel, privilégié et peut être soumis à des droits d'auteur. Il est envoyé à l'intention exclusive de son ou de ses
destinataires. Il est interdit de l'utiliser ou de le divulguer sans autorisation. Les opinions exprimées dans le présent courriel peuvent diverger de celles de Radialpoint.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden