Ping is a networking utility used to test the connection between a local system and its host, measuring the time it takes for packets of data to reach the host, and then return. TCP is a communications protocol part of the internet protocol suite.
This guide will explain what you need to know about both the ping utility and TCP, and how to use ping over a TCP port to check connection. You can learn more about the TCP/IP suite with this networking course, or learn about the other type of communication protocol in this overview of both TCP and UDP.
What is TCP?
TCP stands for transmission control protocol, and is one of the two main communication protocols of the internet. Unlike UDP, or user datagram protocol, TCP is connection-based. It’s used by web browsers to connect to websites over the World Wide Web, and to transfer data from one computer to another.
Instead of breaking data down into smaller packets, which would require multiple IP requests to transfer, an application can make one single request to TCP, and send the data that way. You can learn more about TCP, and other internet protocols like HTTP, in this networking guide.
What is Ping?
Ping is a networking utility that measures latency between two computers connected over a network. In networking, latency is the interval between when a communication is sent, and when a response is received, measuring the round-trip interval between both as a means of determining connectivity.
This is done when the utility sends internet control message protocol (ICMP) packets, or more specifically, “echo requests,” to the host computer or server. A summary containing the results of the ping is printed after the process is complete, a report that contains data about the round-trip time of the connection, and packet loss that might have occurred during the request.
You can learn about this, and more, in this basic computer networking course.
How Do You Ping a TCP port?
There will be times when you might want to manually test a connection over a TCP port using ping. This is very easy to do, as long as you follow the instructions below.
- TCP ping help on Windows
If you’re using Microsoft Windows, the first thing you want to do is open the command prompt. If you’re on a newer operating system, you can do this by opening the Run prompt, typing in cmd.exe, and pressing Enter. Or, if your Start menu has a search bar, just type in cmd and press Enter.
Once the command prompt is open, you’ll see something like this:
Microsoft Windows [Version 6.1.7600] Copyright (c) 2009 Microsoft Corporation. All rights reserved. C:\Users\YourUserName>
From here, type in the word “ping” without the quotes, followed by a space, followed by the IP address or website you want to test the connection between. For instance, let’s say we want to ping Google.com. We’d type in:
Microsoft Windows [Version 6.1.7600] Copyright (c) 2009 Microsoft Corporation. All rights reserved. C:\Users\YourUserName>ping google.com
Press Enter, and it will return the following report:
Microsoft Windows [Version 6.1.7600] Copyright (c) 2009 Microsoft Corporation. All rights reserved. C:\Users\YourUserName>ping google.com Pinging google.com [220.127.116.11] with 32 bytes of data: Reply from 18.104.22.168: bytes=32 time=16ms TTL=55 Reply from 22.214.171.124: bytes=32 time=24ms TTL=55 Reply from 126.96.36.199: bytes=32 time=15ms TTL=55 Reply from 188.8.131.52: bytes=32 time=16ms TTL=55 Ping statistics for 184.108.40.206: Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), Approximate round trip times in milli-seconds: Minimum = 15ms, Maximum = 24ms, Average = 17ms
In this report, 220.127.116.11 is the IP address of the server that Google.com is hosted on. The report shows that four packets were sent, four packets were received, zero packets were lost, and that the average round-trip time in milliseconds was 17. If the echo request was unsuccessful and the ping failed, we would see a message reading “request timed out.”
You can learn about internet protocol and more in this course on IP addressing and subnetting.
- TCP ping help on Mac
Using the ping utility on Mac is much simpler with the Network Utility application. Just open Network Utility and select the Ping tab. You’ll see a text field where you can enter in the IP or website address you want to ping, and the option to send an unlimited amount of pings, or a number of your choice.
Below that is where the result of the ping will be displayed. Once you’re ready to ping your chosen network address, just press the aptly labeled Ping button and watch the results of your request print below.
Want to be a network engineer? Learn more about TCP/IP, ping, and other networking concepts in this course.