java.lang.Object
com.act365.net.ping.Ping
- public class Ping
- extends java.lang.Object
Implements the well-known ping network utility.
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
socket
java.net.DatagramSocket socket
transmitted
int transmitted
isinterrupted
boolean isinterrupted
Ping
public Ping(java.net.DatagramSocket socket,
int transmitted)
- Creates a Ping object to listen for ICMP messages.
interrupt
public void interrupt()
- Interrupts the receive cycle.
receive
public void receive()
- Listens for ICMP packets.
main
public static void main(java.lang.String[] args)
- Executes the Ping service.
Usage:
Ping -c count -s nbytes -p protocol -l localhost -t ttl hostname.
-c count (optional) defines the number of packets to be broadcast.
By default, the broadcast will continue endlessly.
-s nbytes (optional) defines the number of bytes to appear
in each packet. The default is 56.
-p protocol (optional) defines the socket protocol to be used.
By default, ICMP will be used - the alternative is RawICMP.
-l localhost (optional) should be specified if the protocol
has been set to RawICMP. The information will be used to construct the IP header.
-t ttl (optional) is the time-to-live to be used if the RawICMP
protocol has been selected. The default is 64.
hostname define the remote host.