www.cryer.co.uk
Brian Cryer's Web Resources

CryPing: Examples of use

CryPing is a command line utility that extends the functionality of the traditional ping command to include the ability to ping http services and individual ports.

Examples of use:


Simple ping - Test network connectivity

The simplest use of CryPing is to test the network connection between the current PC and a remote network device (typically another PC). You can specify what to ping using either a DNS name or an IP address.

For example, to ping by name:

C:\>cryping www.cryer.co.uk
CryPing - from www.cryer.co.uk v1.6 (build June 2010)
Pinging www.cryer.co.uk [69.89.27.225] with 32 bytes of data:

Reply from 69.89.27.225: bytes=32 time=232ms TTL=248
Reply from 69.89.27.225: bytes=32 time=181ms TTL=248
Reply from 69.89.27.225: bytes=32 time=181ms TTL=248
Reply from 69.89.27.225: bytes=32 time=183s TTL=248

Ping statistics for 69.89.27.225:
    Requests: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times:
    Minimum = 181ms, Maximum = 232ms, Average = 194ms

or by IP address:

C:\>cryping 80.189.94.38
CryPing - from www.cryer.co.uk v1.6 (build June 2010)
Pinging 69.89.27.225 [69.89.27.225] with 32 bytes of data:

Reply from 69.89.27.225: bytes=32 time=180ms TTL=248
Reply from 69.89.27.225: bytes=32 time=180ms TTL=248
Reply from 69.89.27.225: bytes=32 time=180ms TTL=248
Reply from 69.89.27.225: bytes=32 time=182ms TTL=248

Ping statistics for 69.89.27.225:
    Requests: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times:
    Minimum = 180ms, Maximum = 182ms, Average = 181ms

If you can ping a remote device by IP address but not by name then this implies a problem with DNS.

Should CryPing be unable to connect to the remote network address this may be for any number of reasons. Typically it is one of:

CryPing is identical to the standard ping utility when used like this.

Top


Simple monitoring - Audible alarm when ping fails

To monitor a network connection for failure, sounding an audible alarm (beep) when the connection fails use the two flags "-t" and "-alarm". The "-t" flag tells CryPing to continue until stopped (you can stop it by typing control-C), and the "-alarm" flag (or "-a" for short) tells CryPing to sound an alarm should the ping test fail.

For example:

C:>cryping -t -alarm www.cryer.co.uk
CryPing - from www.cryer.co.uk v1.6 (build June 2010)
Pinging www.cryer.co.uk [69.89.27.225] with 32 bytes of data:

Reply from 69.89.27.225: bytes=32 time=179ms TTL=248
Reply from 69.89.27.225: bytes=32 time=182ms TTL=248
Reply from 69.89.27.225: bytes=32 time=180ms TTL=248
.
.

Should the network connection fail then the computer will emit a beep. Ensure that sound is enabled!

You can invert this to give a beep each time ping succeeds and be quiet on failure using "-beep" instead of "-alarm", for example:

C:>cryping -t -beep www.cryer.co.uk
CryPing - from www.cryer.co.uk v1.2 (build June 2010)
Pinging www.cryer.co.uk [69.89.27.225] with 32 bytes of data:

Reply from 69.89.27.225: bytes=32 time=181ms TTL=248
.
.

Top


Ping a port

CryPing can be used to check the connection to an individual port. This is useful as a simple means of testing that a connection can be made to a port.

For example, port 21 is one of the ports used by FTP so to check whether something is listening on port 21 use the command line switch "-port 21":

C:\>cryping -port 21 www.cryer.co.uk
CryPing - from www.cryer.co.uk v1.6 (build June 2010)
Pinging port 21 on www.cryer.co.uk:

Successful connection to www.cryer.co.uk port=21 time=201ms
Successful connection to www.cryer.co.uk port=21 time=192ms
Successful connection to www.cryer.co.uk port=21 time=199ms
Successful connection to www.cryer.co.uk port=21 time=196ms

Ping port statistics for port 21 on www.cryer.co.uk:
    Requests: Made = 4, Successful = 4, Failed = 0 (0% loss),
Approximate round trip times:
    Minimum = 192ms, Maximum = 201ms, Average = 197ms

Port 5900 is used by the popular VNC remote desktop tool:

C:\>cryping -port 5900 www.cryer.co.uk
CryPing - from www.cryer.co.uk v1.6 (build June 2010)
Pinging port 5900 on www.cryer.co.uk:

Failed to connect to www.cryer.co.uk, port 5900
Failed to connect to www.cryer.co.uk, port 5900
Failed to connect to www.cryer.co.uk, port 5900
Failed to connect to www.cryer.co.uk, port 5900

Ping port statistics for port 5900 on www.cryer.co.uk:
    Requests: Made = 4, Successful = 0, Failed = 4 (100% loss)

Which shows that VNC is not used on our server.

Top


Ping a web site - Check if web server is up

CryPing can be used to test whether a web-server is responding to HTTP requests. The -http flag indicates that CryPing should connect using HTTP.

C:\>cryping -http www.cryer.co.uk
CryPing - from www.cryer.co.uk v1.6 (build June 2010)
Pinging www.cryer.co.uk for http status:

Reply from www.cryer.co.uk: 200 OK time=72ms
Reply from www.cryer.co.uk: 200 OK time=42ms
Reply from www.cryer.co.uk: 200 OK time=40ms
Reply from www.cryer.co.uk: 200 OK time=39ms

HTTP ping statistics for www.cryer.co.uk:
    Requests: Sent = 1, Responses = 1, Lost = 0 (0% loss),
    200 OK 4 times (100%)
Approximate round trip times:
    Minimum = 39ms, Maximum = 72ms, Average = 48ms

As well as pinging a webserver, it is also possible to ping an individual page. For example:

C:\>cryping -n 1 -http www.cryer.co.uk/index.htm
CryPing - from www.cryer.co.uk v1.6 (build Jan 2010)
Pinging www.cryer.co.uk/index for http status:

Reply from www.cyrer.co.uk/index.htm: 200 OK time=144ms

HTTP ping statistics for www.cryer.co.uk/index.htm:
    Requests: Sent = 1, Responses = 1, Lost = 0 (0% loss),
    200 OK 1 times (100%)
Approximate round trip times:
    Minimum = 144ms, Maximum = 144ms, Average = 144ms

Should the page not exist then the response will be different, for example:

C:\>cryping -n 1 -http www.cryer.co.uk/index
CryPing - from www.cryer.co.uk v1.6 (build Jan 2010)
Pinging www.cryer.co.uk/index for http status:

Reply from www.cryer.co.uk/index: 404 Not Found time =58ms

HTTP ping statistics for www.cryer.co.uk/index:
    Requests: Sent = 4, Responses = 4, Lost = 0 (0% loss),
    404 Not Found 1 times (100%)
Approximate round trip times:
    Minimum = 58ms, Maximum = 58ms, Average = 58ms

Top


View HTTP headers

Should you wish to view the full HTTP headers when pinging a website then add the -v flag (in addition to -http), for example:

C:\>cryping -http -v -n 1 www.cryer.co.uk
CryPing - from www.cryer.co.uk v1.6 (build June 2010)
Pinging www.cryer.co.uk for http status:

Reply from www.cryer.co.uk: 200 OK time=386ms
HTTP/1.1 200 OK
Date: Mon, 21 Jun 2010 12:51:55 GMT
Server: Apache/2.2.15 (CentOS) mod_ssl/2.2.15 0.9.8l DAV/2 mod_auth_passthrough/2.1 FrontPage/5.0.2.2635
Last-Modified: Wed, 19 May 2010 17:44:16 GMT
Accept-Ranges: bytes
Content-Length: 8049
Connection: close
Context_Type: text/html

HTTP ping statistics for www.cryer.co.uk:
    Requests: Sent = 1, Responses = 1, Lost = 0 (0% loss),
    200 OK 1 times (100%)
Approximate round trip times:
    Minimum = 386ms, Maximum = 386ms, Average = 386ms

Top


Test email server (POP3 and SMTP)

To test that an email server is up requires checking both POP3 and SMTP. POP3 is the protocol used to pull emails down from a server and SMTP is the protocol used to send emails. You can check each of these on their own, this example checks both at the same time to show how to check more than one protocol at the same time. For example:

C:\>cryping -pop3 -smtp www.cryer.co.uk
CryPing - from www.cryer.co.uk v1.6 (build Jyb 2010)
Pinging www.cryer.co.uk for SMTP status:
Pinging www.cryer.co.uk for POP3 status:

Reply from www.cryer.co.uk: 220 Service ready time=0.90s
Reply from www.cryer.co.uk: +OK Postive - Success time =374ms
Reply from www.cryer.co.uk: 220 Service ready time=0.70s
Reply from www.cryer.co.uk: +OK Postive - Success time =379ms
Reply from www.cryer.co.uk: 220 Service ready time=0.87s
Reply from www.cryer.co.uk: +OK Postive - Success time =382ms
Reply from www.cryer.co.uk: 220 Service ready time=0.71s
Reply from www.cryer.co.uk: +OK Postive - Success time =376ms

SMTP ping statistics for www.cryer.co.uk:
    Requests: Sent = 4, Responses = 4, Lost = 0 (0% loss).
    220 Service ready 4 times (100%)
Approximate round trip times:
    Minimum = 0.70s, Maximum = 0.90s Average = 0.80s
POP3 ping statistics for www.cryer.co.uk:
    Requests: Sent = 4, Responses = 4, Lost = 0 (0% loss).
    +OK Positive - Success 4 times (100%)
Approximate round trip times:
    Minimum = 374ms, Maximum = 382ms, Average = 378ms

Which shows that both SMTP and POP servers are responding, but that our POP3 is faster at responding than the SMTP server.

Top