Re: Using NSStream fails
Re: Using NSStream fails
- Subject: Re: Using NSStream fails
- From: Ivan C Myrvold <email@hidden>
- Date: Wed, 21 Jul 2004 20:45:29 +0200
Fra: email@hidden
Emne: Re: Using NSStream fails
Dato: 21. juli 2004 20.11.56 MET
Til: email@hidden
I found the problem myself, by sniffing on the packets sent/received.
It looks like it tries to do a dns lookup, even if I use [NSHost
hostWithAddress]. I worked around that, using my dyndns name, and
[NSHost hostWithName]. Then it works.
Ivan
Pe 21. jul. 2004 kl. 18.33 skrev Ivan Myrvold:
>
I am trying to connect to a Unix app called asterisk running on my
>
computer on port 5038, but I always get the following error
>
>
NSError "POSIX error: Socket operation on non-socket"
>
Domain=NSPOSIXErrorDomain Code=38
>
>
I don't know what I am doing wrong here. I hope someone knows.
>
>
I am using the SocketStreamTest (which I found here
>
http://homepage.mac.com/gallenx/.cv/gallenx/Public/
>
SocketStreamTest.zip-link.zip ) which have the following action on the
>
connect button:
>
>
- (IBAction)connect:(id)sender
>
{
>
// Connect to the specified host
>
[NSStream getStreamsToHost:[NSHost hostWithAddress:[hostField
>
stringValue]]
>
port:[portField intValue]
>
inputStream:&inputStream
>
outputStream:&outputStream];
>
>
[inputStream retain];
>
[outputStream retain];
>
>
// Set ourself to to the delegate, schedule ourselves in the
>
runloop, and open the streams
>
[inputStream setDelegate:self];
>
[outputStream setDelegate:self];
>
>
[inputStream scheduleInRunLoop:[NSRunLoop currentRunLoop]
>
forMode:NSDefaultRunLoopMode];
>
[outputStream scheduleInRunLoop:[NSRunLoop currentRunLoop]
>
forMode:NSDefaultRunLoopMode];
>
>
[inputStream open];
>
[outputStream open];
>
>
return;
>
}
>
>
If I connect to the Unix application in Terminal, I have no problems:
>
>
G4:~ imyrvold$ telnet 192.168.207.242 5038
>
Trying 192.168.207.242...
>
Connected to 192.168.207.242.
>
Escape character is '^]'.
>
Asterisk Call Manager/1.0
>
_______________________________________________
>
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.
_______________________________________________
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.