views:

913

answers:

4

Using WinPcap I crafted a series of custom UDP packets and injected them into the Ethernet layer.

I sent 1000 packets, 1440 bytes each. It takes 2.1 sec for 100 Mbps bandwidth.

How do I make use of full bandwidth?

+1  A: 

Your throughput seems to be exactly the max you'd get for a 10 mbit connection. Sure there's no 10mbit involved anywhere ?

krosenvold
+1  A: 

Originally I misread the question, and thought that it was a duplicate of this. But the 100Mbps makes it completely different.

Even very modest hardware should be able to saturate a 100Mbps connection with no problems - particularly if you're using 1440 byte udp packets.

As suggested by krosenvold, the figures do look suspiciously like a 10Mbps connection, rather than 100Mbps. I would check all of the links from end to end to make sure that they are at the 100Mbps that you believe them to be. Any 10Mbps link in that chain is going to be a problem.

Depending on the equipment that you're using you may find that there have been issues with link autonegotiation. Some equipment is notoriously bad, so you may find better results by turning autonegotiation off, and forcing the link speeds to 100Mbps.

And as you have a pcap file that you're using, I would suggest trying tcpreplay to do some speed testing. There are several options that tcpreplay provides to replay files at the highest possible speed. (in particular, look at this wiki entry)

If that gives you different results than you're seeing at the moment it could point to a problem with the pcap file. For example, the pcap files do contain timing information that can be used when replaying the file. If the timing in your pcap file was taken from a 10Mbps network (for example) then replaying it in real time will give you the result that you're seeing.

Andrew Edgecombe
A: 

Make sure all devices and mediums on the data exchange route are operating at 100 mbps, a connection is only as fast as it's weakest link. Also make sure all devices (including your network card) are operating in Full-Duplex mode.

John T
A: 

What about CPU usage during the transfer?

We need to find the bottleneck. It can be the NIC/network or the CPU. Make sure that you are not "opening" the NIC for each packet.

Wrong:

loop{
   OpenDevice
   SendPacket
}

Good:

OpenDevice
loop{
 SendPacket
}
Kalmi
ya you are right kalmiare you telling me to try multiple frames in a single packet?.
krishnakumar
um... no that wouldn't make much sense... and the packets are big enough... Could you show us some code? We don't even know yet what language you are using... or what API...
Kalmi
hi kalmi gimme your mail id let me send my code.i m using Winpcap for this
krishnakumar
kalmi tell me how to use pcap_sendqueue_queue() in Winpcap API.instead of sending .pcap or .cap fileneed to send my own Raw UDP packets.
krishnakumar
Please use some online service (like pastebin.com) to share code and post the link here or just edit the question. All this is not just about helping you. It is also about letting others who run into the same problem later find the solution.
Kalmi
http://pastebin.com/f25331b93 hi sir this is my code.
krishnakumar
You are calling pcap_open for each packet (pcap_open is expensive in my experience), don't do that.You are turning promiscuous mode on before sending the packet, and then off after sending a packet by "opening" and "closing" the device.
Kalmi
pass the result of pcap_open to your SendPacket function and use it
Kalmi
hi kalmi its giving an error Error opening the adapter
krishnakumar
Can you post the changed code?
Kalmi
You might want to start a new question on how to use pcap_sendqueue_queue in the Winpcap API. That is your best bet performance-wise.
Kalmi
hi i started as a new question
krishnakumar