|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||
java.lang.Object
|
+--java.net.RawSocket
|
+--java.net.IcmpSocket
This class represents a socket for sending and receiving Icmp packets.
An Icmp socket is the sending or receiving point for a packet delivery service. Each packet sent or received on a datagram socket is individually addressed and routed. Multiple packets sent from one machine to another may be routed differently, and may arrive in any order.
RawPacket| Constructor Summary | |
IcmpSocket()
Creates an Icmp socket. |
|
IcmpSocket(InetAddress laddr)
Creates an Icmp socket, bound to the specified local address. |
|
| Method Summary | |
void |
close()
Closes this Icmp socket. |
void |
receive(IcmpPacket p)
Receives an Icmp packet from this socket. |
void |
receive(RawPacket p)
This method overrides the one of the RawSocket class. |
void |
send(IcmpPacket p)
Sends an Icmp packet from this socket. |
void |
send(RawPacket p)
This method overrides the one of the RawSocket class. |
void |
setChecksum(int offset)
This method overrides the one of the RawSocket class. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public IcmpSocket()
throws java.net.SocketException
RawSocket
public IcmpSocket(InetAddress laddr)
throws java.net.SocketException
laddr - local address to bindRawSocket| Method Detail |
public void send(IcmpPacket p)
throws java.io.IOException
IcmpPacket includes information indicating the
data to be sent, its length, the IP address of the remote host.p - the IcmpPacket to be sent.java.io.IOException - if an I/O error occurs.IcmpPacket
public void send(RawPacket p)
throws java.io.IOException
RawSocket class. It throws an
IOException to prevent people from hacking the protocol.send in class RawSocketjava.io.IOException - RawSocket
public void receive(IcmpPacket p)
throws java.io.IOException
IcmpPacket's buffer is filled with
the data received. The Icmp packet also contains the sender's
IP address, and the type and code of the packet.
This method blocks until a datagram is received. The
length field of the datagram packet object contains
the length of the received message. If the message is longer than
the buffer length, the message is truncated.
p - the IcmpPacket into which to place
the incoming data.java.io.IOException - if an I/O error occurs.IcmpPacket,
RawSocket
public void receive(RawPacket p)
throws java.io.IOException
RawSocket class. It throws an
IOException to prevent people from hacking the protocol.receive in class RawSocketjava.io.IOException - RawSocket
public void setChecksum(int offset)
throws java.net.SocketException
RawSocket class. It throws an
IOException to prevent people from hacking the protocol.setChecksum in class RawSocketjava.net.SocketException - RawSocketpublic void close()
close in class RawSocket
|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||