Re: Test for TCP port

2011-04-09 Thread René v Amerongen
I remember that I did look into Smallsockets, but never used it. But maybe 
perfect for you.

HTH


Op 9 apr 2011, om 05:04 heeft Heizer, Charles het volgende geschreven:

 Thanks,
 This is what I kind of suspected. Are there any wrappers around bsd socket to 
 make it easier?
 
 Thanks,
 Charles
 
 
 
 On Apr 8, 2011, at 5:17 PM, Dave Carrigan wrote:
 
 
 On Apr 8, 2011, at 3:26 PM, Heizer, Charles wrote:
 
 What is the best way to test to see if a TCP port is reachable and will 
 answer connections? I was trying to use NSSocketPort and NSConnection but 
 I'm not getting a valid connection.
 
 You have to connect to it. Unfortunately, neither NSSocketPort nor 
 NSConnection attempt to connect until you send data, so with those, you have 
 no way of immediately knowing that anything is actually listening. The best 
 way is to get down a level and use socket(2) and friends.
 
 -- 
 Dave Carrigan
 d...@openshut.net
 Seattle, WA, USA
 
 
 --
 Charles Heizer
 Systems Management Solutions Group
 Lawrence Livermore National Laboratory
 P: 925-422-0197   
 
 
 
 ___
 
 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/appledev%40xs4all.nl
 
 This email sent to apple...@xs4all.nl

___

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


Test for TCP port

2011-04-08 Thread Heizer, Charles
Hello,
What is the best way to test to see if a TCP port is reachable and will answer 
connections? I was trying to use NSSocketPort and NSConnection but I'm not 
getting a valid connection.

Thanks,
Charles


NSSocketPort *sendPort = [[NSSocketPort alloc] initRemoteWithTCPPort:3600 
host:@test.myhost.comhttp://test.myhost.com];
NSConnection *connection = [NSConnection connectionWithReceivePort:nil 
sendPort:sendPort];


[connection setRequestTimeout:10.0];
[connection setReplyTimeout:10.0];


NSLog(@theConnection 0x%X, connection);
NSLog(@Connect is valid? %d, (int)[connection isValid]);
___

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: Test for TCP port

2011-04-08 Thread Kyle Sluder
On Fri, Apr 8, 2011 at 3:26 PM, Heizer, Charles heiz...@llnl.gov wrote:
 What is the best way to test to see if a TCP port is reachable and will 
 answer connections? I was trying to use NSSocketPort and NSConnection but I'm 
 not getting a valid connection.

The *only* way to correctly determine if a TCP port can be connected
is to attempt the connection.

--Kyle Sluder
___

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: Test for TCP port

2011-04-08 Thread Sherm Pendley
On Fri, Apr 8, 2011 at 6:26 PM, Heizer, Charles heiz...@llnl.gov wrote:

 What is the best way to test to see if a TCP port is reachable and will 
 answer connections? I was trying to use NSSocketPort and NSConnection but I'm 
 not getting a valid connection.

 NSSocketPort *sendPort = [[NSSocketPort alloc] initRemoteWithTCPPort:3600 
 host:@test.myhost.comhttp://test.myhost.com];

That's not a valid host name. Try connecting to just @test.myhost.com instead.

sherm--

-- 
Cocoa programming in Perl:
http://camelbones.sourceforge.net
___

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: Test for TCP port

2011-04-08 Thread Dave Carrigan

On Apr 8, 2011, at 3:26 PM, Heizer, Charles wrote:

 What is the best way to test to see if a TCP port is reachable and will 
 answer connections? I was trying to use NSSocketPort and NSConnection but I'm 
 not getting a valid connection.

You have to connect to it. Unfortunately, neither NSSocketPort nor NSConnection 
attempt to connect until you send data, so with those, you have no way of 
immediately knowing that anything is actually listening. The best way is to get 
down a level and use socket(2) and friends.

-- 
Dave Carrigan
d...@openshut.net
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


Re: Test for TCP port

2011-04-08 Thread Heizer, Charles
Thanks,
This is what I kind of suspected. Are there any wrappers around bsd socket to 
make it easier?

Thanks,
Charles



On Apr 8, 2011, at 5:17 PM, Dave Carrigan wrote:

 
 On Apr 8, 2011, at 3:26 PM, Heizer, Charles wrote:
 
 What is the best way to test to see if a TCP port is reachable and will 
 answer connections? I was trying to use NSSocketPort and NSConnection but 
 I'm not getting a valid connection.
 
 You have to connect to it. Unfortunately, neither NSSocketPort nor 
 NSConnection attempt to connect until you send data, so with those, you have 
 no way of immediately knowing that anything is actually listening. The best 
 way is to get down a level and use socket(2) and friends.
 
 -- 
 Dave Carrigan
 d...@openshut.net
 Seattle, WA, USA
 

--
Charles Heizer
Systems Management Solutions Group
Lawrence Livermore National Laboratory
P: 925-422-0197 



___

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