Ops, thanks! 

I have not really done much with sockets. Is there an example you know of that 
I can learn from?

Thanks,
tom


On Nov 7, 2010, at 2:14 PM, Dave Carrigan wrote:

> On Nov 7, 2010, at 2:02 PM, Tom Jones wrote:
>> Thanks, yes its a tcp port. I tried this but for some reason "port" is 
>> always nil.
>> 
>> NSSocketPort *port = [[NSSocketPort alloc] initRemoteWithTCPPort:3651 
>> host:@"localhost"];
>> if(!port) {
>>  NSLog(@"Port is open...");   
>> } else {
>>  NSLog(@"Port is not open...");
>> }
>> [port release];
> 
> As Scott pointed out, your check is backwards. In addition, the discussion of 
> that initializer says that the connection is not opened until data is sent, 
> so it doesn't really matter what it returns - it still tells you nothing 
> about if the host is actually listening on that port. For that, you would 
> actually need to send some data and look at the result. You are way better 
> off dropping down to socket/connect.
> 
> -- 
> Dave Carrigan
> d...@rudedog.org
> Seattle, WA, USA
> 

_______________________________________________

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

Reply via email to