Modifier and Type | Class and Description |
---|---|
static interface |
IcmpSocket.Logger |
Constructor and Description |
---|
IcmpSocket(short id)
Constructs a new socket that is able to send and receive ICMP messages.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
This method is used to close and release the resources associated with the
instance.
|
void |
dontFragment()
This method is used to set the "Don't Fragment" bit for the socket.
|
DatagramPacket |
receive()
This method is used to receive the next ICMP datagram from the operating
system.
|
void |
send(DatagramPacket packet)
This method is used to send the passed datagram using the ICMP transport.
|
void |
setTrafficClass(int tc)
This method is used to set the traffic class for the socket.
|
public IcmpSocket(short id) throws IOException
IOException
- This exception is thrown if the socket fails to be opened
correctly.public final void setTrafficClass(int tc) throws IOException
Socket.setTrafficClass(int)
.tc
- the traffic classIOException
public final void dontFragment() throws IOException
IOException
public final DatagramPacket receive() throws IOException
IOException
- Thrown if an error occurs reading the next ICMP message.public final void send(DatagramPacket packet) throws IOException
IOException
- Thrown if an error occurs sending the datagram to the
remote host.NoRouteToHostException
- Thrown if the destination address is a broadcast address.public final void close()
Copyright © 2002–2023 The OpenNMS Group, Inc.. All rights reserved.