2010-04-15 60 views

回答

4

您必须将Packet对象转换为我认为正确的Packet类型。

因此,像:

TCPPacket p = (TCPPacket)packet; 

// Get the tcp src and dest ports 
int destPort = p.dst_port; 
int srcPort = p.src_port; 

// Get the src and dest IP addresses from the IP layer 
InetAddress destIp = p.dst_ip; 
InetAddress srcIp = p.src_ip; 
+0

感谢访问的数据包信息的好example!你救了我这么多丑陋的解析 – 2010-04-15 05:26:46

1

下面是关于使用JPCAP包