Display Packet Data

Jun 26, 2011 at 4:09 AM


I am using Pcap.net to capture packet. I am trying to read IPv4 payload which returns me a byte array.

But when i convert it to string format by converting individual byte to char, i got unreadable ASCII characters.

Please tell me how to read that payload for displaying data in it.


Jun 27, 2011 at 1:30 PM

Hi deshprateek,


You're trying to print binary data.

There are different ways to print binary data, one of the general ones is simply convert the bytes to hexadecimal strings.

This can be done in many ways, see http://stackoverflow.com/questions/311165/how-do-you-convert-byte-array-to-hexadecimal-string-and-vice-versa-in-c


I hope this helps,