|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjpcap.JpcapSender
public class JpcapSender
This class is used to send a packet.
Method Summary | |
---|---|
void |
close()
Closes the interface. |
static JpcapSender |
openDevice(NetworkInterface device)
Initializes a network interface for sending a packet, and returns an instance of this class. |
static JpcapSender |
openRawSocket()
Deprecated. |
void |
sendPacket(Packet packet)
Sends a packet. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static JpcapSender openDevice(NetworkInterface device) throws java.io.IOException
device
- Interface for sending a packet
IOException
- Raised when initialization of the interface failed@Deprecated public static JpcapSender openRawSocket() throws java.io.IOException
Note: the implementation and behavior of a raw socket may vary in different OS. Also, you can only open one raw socket at a time.
IOException
- Raised when initialization of the interface failedpublic void close()
public void sendPacket(Packet packet)
If this JpcapSender instance was created by openDevice(), you need to set the Datalink layer's header (e.g., Ethernet header) of the packet.
If this JpcapSender instance was created by openRawSocket(), you can only
send IP packets, but you may not need to set the Datalink layer's header
of the IP packets you want to send.
Note: the implementation and behavior of a raw socket may vary in different OS.
For example, in Windows 2000/XP, you need to manually set the datalink/IP headers
of a packet.
packet
- Packet to be sent
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |