Re: NSHost and NSStream question
Hi, I finally fixed my problem. The server was not opening the port properly, so the client could not connect. It as error 61 of POSIX domain. Seems to work fine now. Thanks, Mathieu On 2010-01-21, at 4:37 PM, Jens Alfke wrote: > > On Jan 21, 2010, at 6:43 AM, Mathieu Coursolle wrote: > >> If I initialize the IP address as 127.0.0.1, or my own 192.168.1.x address, >> it creates the NSHost and >> NSOutputStream properly, but I always get a connection refused error. > > What's the exact error domain and code? > > Since SSL is involved, are you sure the server's certificate is acceptable, > i.e. unexpired and authorized by a root cert that's known to OS X? (It's > possible to get CFNetwork to accept other certs, but you have to set some > other properties.) > > —Jens ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSHost and NSStream question
On Jan 21, 2010, at 6:43 AM, Mathieu Coursolle wrote: > If I initialize the IP address as 127.0.0.1, or my own 192.168.1.x address, > it creates the NSHost and > NSOutputStream properly, but I always get a connection refused error. What's the exact error domain and code? Since SSL is involved, are you sure the server's certificate is acceptable, i.e. unexpired and authorized by a root cert that's known to OS X? (It's possible to get CFNetwork to accept other certs, but you have to set some other properties.) —Jens___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
NSHost and NSStream question
Hi Cocoa developers, I am writing a small application that acts as a TCP client for another application (TCP server). The client nows the IP address and port of the server. I then use NSStream to create an output stream from an NSHost (see code bellow). If I initialize the IP address as 127.0.0.1, or my own 192.168.1.x address, it creates the NSHost and NSOutputStream properly, but I always get a connection refused error. Does anybody see what I am doing wrong here ? Thanks! Mathieu NSHost* host = [NSHost hostWithAddress:@"127.0.0.1"]; [NSStream getStreamsToHost:host port:5000 inputStream:nil outputStream:&outputStream]; [self setOutputStream:outputStream]; [outputStream setProperty:NSStreamSocketSecurityLevelNegotiatedSSL forKey:NSStreamSocketSecurityLevelKey]; [outputStream setDelegate:self]; [outputStream scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode]; [outputStream open];___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com