this is my first question here so be gentle !
recently i try to build application who can take Wireshark file and send all the packet to the network, after few days of reading i found Pcap.Net project and after build my application (winform) i want to add advanced option like change the IP address, MAC address etc.. and Pcap.Net support all this.
in my example after the allocate the buffer i try to change the packet ip, build new packet (with the new ip) and fill the buffer with all the packet from my file (before sending):
// Allocate a send buffer
using (PacketSendBuffer sendBuffer = new PacketSendBuffer((uint)capLength))
{
// Fill the buffer with the packets from the file
int numPackets = 0;
Packet packet;
while (inputCommunicator.ReceivePacket(out packet) == PacketCommunicatorReceiveResult.Ok)
{
IpV4Layer ipLayer = (IpV4Layer)packet.Ethernet.IpV4.ExtractLayer();
ipLayer.Destination = new IpV4Address("11.12.13.14");
EthernetLayer ethernet = (EthernetLayer)packet.Ethernet.ExtractLayer();
PayloadLayer payload = (PayloadLayer)packet.Ethernet.Payload.ExtractLayer();
Packet newPacket = PacketBuilder.Build(DateTime.Now, ethernet, ipLayer, ipLayer, payload);
sendBuffer.Enqueue(newPacket);
++numPackets;
}
outputCommunicator.Transmit(sendBuffer, isSync); //Transmit the queue
}
My problen is that after the line sendBuffer.Enqueue(newPacket).
I receive the following error: Failed enqueueing to SendQueue
maybee somone can help me understand whats wrong ?
should be
what i have done