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: Kyle Sluder <email@hidden>
- Date: Fri, 6 Feb 2009 17:58:41 -0500
On Fri, Feb 6, 2009 at 9:58 AM, Tim Murison <email@hidden> wrote:
> My client application communicates with the server using Unix Domain
> Sockets. After creating a properly configured NSSocketPort (sendPort) for
> the client, I create the NSConnection as follows:
You're going to need to post the code you use to create the UNIX socket handle.
> 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."
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.
> Thus far I have no problem with this. The issue is that NSSocketPort's init
> message, described as follows in the documentation, "Initializes the
> receiver as a local TCP/IP socket of type SOCK_STREAM.", creates a socket
> that listens on a random port for _any_ inbound connection.
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: ?
> I guess my question is, why does [NSSocketPort init] listen on 0.0.0.0
> instead of 127.0.0.1, and is this a valid issue that I should report to
> Apple?
0.0.0.0 is known as INADDR_ANY. The socket will be bound on all
interfaces. Binding on 127.0.0.1 would only allow connections over
the loopback interface, which kind of defeats the purpose of DO.
--Kyle Sluder
_______________________________________________
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