This project is read-only.

Is it possible to create Packet from Byte[] ?

Apr 17, 2013 at 7:53 PM
Edited Apr 17, 2013 at 8:49 PM
i found a little tool that open Pcap file and because the Winpcap bug i think i can use this tool in order to put all the packets inside SendBuffer instead of do it with Pcapdot.Net method.
is it possible to create Packet from Byte[] ? (this tool use different Packet class but can return the packet in Byte[])
Apr 17, 2013 at 10:48 PM
you can write inside Packet.Buffer one byte at a time but you can't do Packet.Buffer = new byte[] {...}
this means that the buffer of your PcapDotNet packet has to be the same size of your byte array.
Apr 18, 2013 at 4:10 AM
can you show me an example how to do it ?
Apr 20, 2013 at 10:57 AM
Yes, you can create a Packet from a byte[] using the Packet constructor:
public Packet(byte[] data, DateTime timestamp, DataLinkKind dataLink)
public Packet(byte[] data, DateTime timestamp, IDataLink dataLink)
I hope this helps,

Apr 20, 2013 at 12:10 PM
Edited Apr 20, 2013 at 12:39 PM
when create the new packet from Byte[] how can i use the original packet Timestamp (this packet is Byte[]) instead of using DateTime.Now which cause the buffer to be transmitted fast ?
Apr 27, 2013 at 9:58 AM
If you have an original packet, you can pass it the timestamp using the Timestamp property:
public DateTime Timestamp