0
我用PcapDotnet包裝器嗅探數據包,但它只顯示IP原始數據包 例如在客戶方我發送一個數據包的Tcp原始數據包
client_.Send(ASCIIEncoding.ASCII.GetBytes("test"));
,並在服務器端,我想捕捉「測試」,但packet.Buffer顯示不同的66個字節。我可以得到「測試」數據包嗎?
private static void PacketHandler(Packet packet)
{
IpV4Datagram ip = packet.Ethernet.IpV4;
TcpDatagram tcp = ip.Tcp;
if (tcp.DestinationPort == 28001 || tcp.SourcePort == 28001)
{
File.AppendAllText("return.txt", ASCIIEncoding.ASCII.GetString(packet.Buffer));
Console.WriteLine(ip.Source + ":" + tcp.SourcePort + " -> " + ip.Destination + ":" + tcp.DestinationPort);
}
}
我用packetDotNet包裝並且收到了有效載荷 正確的數據包((packet.PayloadPacket).PayloadPacket).PayloadData, – 2015-04-16 11:01:08