• 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
Re: Ping host and port
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Ping host and port


  • Subject: Re: Ping host and port
  • From: Tom Jones <email@hidden>
  • Date: Sun, 7 Nov 2010 14:02:46 -0800

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];

Thanks,
tom

On Nov 7, 2010, at 1:44 PM, Dave Carrigan wrote:

> On Nov 7, 2010, at 1:35 PM, Tom Jones wrote:
>
>> I'm looking for a simple way to ping a host and a specific port on that host. I have SCNetworkCheckReachabilityByName working just fine but I really need to test to see if the port is active.
>
>
> ICMP (ping) doesn't use ports. I assume you actually want to determine if a host is listening on a TCP or UDP port. Actually, there is no real way to know if a host is listening on a UDP port unless you also know what particular kind of service is associated with that port and know what to look for when a host receives UDP packets on the port in question. So most likely you mean a TCP port. For that, a combination of socket(2) and connect(2) should tell you what you need to know.
>
> --
> Dave Carrigan
> email@hidden
> Seattle, WA, USA
>

_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Ping host and port
      • From: Dave Carrigan <email@hidden>
    • Re: Ping host and port
      • From: Scott Ribe <email@hidden>
References: 
 >Ping host and port (From: Tom Jones <email@hidden>)

  • Prev by Date: Moving Properties to
  • Next by Date: Re: CATransaction setCompletionBlock - Nested Transactions bug?
  • Previous by thread: Re: Ping host and port
  • Next by thread: Re: Ping host and port
  • Index(es):
    • Date
    • Thread