ping : Java Glossary


Ping is a common unix and Windows utility. You give it a domain name or IP (Internet Protocol) and it tells you the corresponding IP and whether that site is up or not. It is the smaller brother of TraceRt that tells you about all the hops necessary to reach that destination. The other function of ping it to determine how long it takes to send a packet and get a response. You might ping several alternate sources and use the one with the shortest ping. Napster automatically displays ping times for all potential downloads.

According to Wayne Kovsky, ping implementations rely on ICMP (Internet Control Message Protocol), which is a low-level protocol designed for network administration and not supported in Java. Java supports the higher level datagrams and TCP/IP (Transmission Control Protocol/Internet Protocol) streams. It does not use a TCP/IP port.

But, you can simulate the functionality of ping, by opening a socket to the host and sending a message to some known port. This technique (with sample source code) is described in Peter van der Linden’s book. It will probably be sufficient for your requirements, even though it is not a real ping. Port 7, the echo port is commonly used.

You can use ping to estimate how many of your packets are getting through the first time.

rem Ping continuously with 1000 byte packets.

ping  -t -1 1000

rem results will tell you of any errors, sorry no accumulated stats.

If ping fails, it might simply mean the server does not support the ping protocol. Many servers are dropping support to avoid a DOS (Denial of Service attack).

book cover recommend book⇒Just Java 2, sixth editionto book home
by Peter van der Linden 978-0-13-148211-1 paperback
publisher Prentice Hall 978-0-13-700990-9 eBook
published 2004-07-01 978-0-13-493982-7 audio
  B001MDC0FW kindle
Covers Java 5 aka 1.5. Peter has a sense of humour and breaks the drudgery of reading with a funny story at the end of each chapter. He explains through simple examples. This is a book you can sit down and read and not fall asleep. I helped edit and proofread the chapters on enums and genericity. This is good introduction that won’t overwhelm you.
Australian flag abe books anz abe UK flag
German flag abe UK flag
German flag abe Canadian flag
Spanish flag Canadian flag
Spanish flag Chapters Indigo Canadian flag
French flag abe abe American flag
French flag American flag
Italian flag abe Barnes & Noble American flag
Italian flag Nook at Barnes & Noble American flag
India flag Kobo American flag
UN flag other stores Google play American flag
O’Reilly Safari American flag
Powells American flag
To avoid denial of service attacks, some sites ignore pings. In that case you must use tracert. It takes much longer and so is less useful for hassling a server.

This page is posted
on the web at:

Optional Replicator mirror
on local hard disk J:

Please the feedback from other visitors, or your own feedback about the site.
Contact Roedy. Please feel free to link to this page without explicit permission.

Your face IP:[]
You are visitor number