0% found this document useful (0 votes)
119 views3 pages

Ping

The document discusses using the ping command to test network connectivity between computers. Ping sends echo request packets to a target system and listens for reply packets to check if the target is reachable. It is commonly used as a first step in troubleshooting connectivity issues. The document provides examples of pinging an IP address and the loopback address to test the TCP/IP stack. It also includes a Java program that pings a target IP address and prints the results.

Uploaded by

priyack
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
119 views3 pages

Ping

The document discusses using the ping command to test network connectivity between computers. Ping sends echo request packets to a target system and listens for reply packets to check if the target is reachable. It is commonly used as a first step in troubleshooting connectivity issues. The document provides examples of pinging an IP address and the loopback address to test the TCP/IP stack. It also includes a Java program that pings a target IP address and prints the results.

Uploaded by

priyack
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Ping

You can use ping(packet Internet groper) command to verify the network connectivity of a computer. Ping checks the host name, IP address, and that the remote system can be reached. Ping uses the ICMP ECHO_REQUEST datagrams to check connections between hosts by sending an echo packet, then listening for the reply packets.This command is used to test a machine's connectivity to another system and to verify that the target system is active. Usually, using this command is the first step to any troubleshooting if a connectivity problem is occurring between two computers. This can quickly help you to determine whether a remote host is available and responsive. Using Ping:1. If you are using Windows NT/2000, go to the command prompt by selecting Start | Run and then type CMD. If you are using Windows 95/98/ME, go to Start | Run, and type COMMAND. 2. At the command prompt, type: ping <ip address>. In this example we are pinging the IP address of 117.194.0.24 3. You will get four replies back from the ping message if the system you have pinged is up and running, as shown next.

4. To test your TCP/IP software stack, you can ping the loopback address by typing ping 127.0.0.1. 5. If you receive four lines of information showing successes, the TCP/IP protocol is initialized and functioning. Four lines of failed transmissions will show that TCP/IP is not initialized and cannot be used to perform network transmissions. The results of a successful ping to 127.0.0.1 are shown below.

(note:- For more options type "ping /?" in the command prompt. In Unix system ping works equally well .For knowing more about ping in unix type "man ping" in the console)

import java.net.*; import java.io.*; import java.util.*; public class pingTest { public static void main(String[] args) { String ip = args[0]; String pingResult = ""; String pingCmd = "ping " + ip; try { Runtime r = Runtime.getRuntime(); Process p = r.exec(pingCmd); BufferedReader in = new BufferedReader(new InputStreamReader(p.getInputStream())); String inputLine; while ((inputLine = in.readLine()) != null) { System.out.println(inputLine); pingResult += inputLine; } in.close();

}//try catch (IOException e) { System.out.println(e); } } }

You might also like