• 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
Using NSStream fails
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Using NSStream fails


  • Subject: Using NSStream fails
  • From: Ivan Myrvold <email@hidden>
  • Date: Wed, 21 Jul 2004 18:33:42 +0200

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.


  • Follow-Ups:
    • Re: Using NSStream fails
      • From: Brian Bergstrand <email@hidden>
  • Prev by Date: Global Floating Windows?
  • Next by Date: Re: Global Floating Windows?
  • Previous by thread: Re: Global Floating Windows?
  • Next by thread: Re: Using NSStream fails
  • Index(es):
    • Date
    • Thread