Cocoa versus Carbon networking issue.
Cocoa versus Carbon networking issue.
- Subject: Cocoa versus Carbon networking issue.
- From: "Kenny Millar" <email@hidden>
- Date: Fri, 6 Jan 2006 14:26:49 -0000
I'm still struggling with my cocoa app, which uses NSInputStream and
NSOutputStream.
I've discovered exactly what the issue is, but cannot find a way to resolve
it. I'd really appreciate some help.
I use [NSStream getStreamsToHost:[NSHost hostWithAddress:serverAddress]
port:41000 <snip>] to get the streams, and connect to the host.
If serverAddress is @"192.168.1.119" then everything works fine. No problems
at all.
If serverAddress is @"192.168.1.120" then it does not work and I get an
error immediately in my stream:handleEvent handler.
I discovered that I can ping the .119 address by both ip address and host
name
I can ping the .120 address only by ip address and NOT by host name.
What I have discovered by using the debugger is that the 'hostWithAddress'
message is returning a host, containing the hostname, not the IP address
(despite only providing the ip address). So it is getting the host name by
some opaque method. Of course the getStreamsToHost message the fails,
because that host is not available via it's hostname.
Now, I knocked up a quick test in Carbon using it's equivalent functions,
and guess what? It all works fine in Carbon - the ip address does NOT get
munged to a hostname. The carbon fn I'm using is
CFStreamCreatePairWithSocketToHost(...) .
I know I can just add the host name to my /etc/hosts file but I'd rather not
do that.
So how can I force getStreamsToHost to use the ip address and not the
hostname? It seems there is no way to do it.
-KennyM.
_______________________________________________
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