Using the Terminal to ping a port number?



Is it possible to ping a port number in the terminal?


You can telnet to a specific port on a remote host to test that it responds:

[bob@freebird] ~> telnet dakota 25
Connected to dakota.
Escape character is '^]'.
220 ESMTP Postfix
telnet> quit
Connection closed.


To get around this I have been using telnet, you can do it in windows ok so you must be able to do it in OS X.

Ping uses ICMP Packets, first type 8, ECHO, then the response, type 0, ECHO_REPLY, these packets are datagrams, and therefor can not attach to ports since they act on layer 1 and 2, but do not go up to layer 3 or above, so they will stay in the NIC and not go into the TCP/IP Stack in the kernel.

IIRC, when you do a ping in Windows, and specify a port, its an actual TCP packet, and not an ICMP packet.

You have to remember, OS X is very standards compliant, more than other OS's, therefor, the "features" in other OS's might not work, but what does work, works as per the RFC/standards that define them.