Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I was testing the throughput between two pcs, connected on the same router, one with 100mbps lan, the other with 54mbps wifi.

Here is the interesting part:

  • using nc, I get 2.63MB/s when sending from A to B (measured with pv -r|nc ipB)
  • using iperf, I get 23MB/s which is pretty much ok.

What could be wrong with nc?

The OS is ubuntu 11.04 for both.

share|improve this question
    
I have a very similar question that you might find useful: Measuring network throughput with netcat vs. CIFS/SMB transfer rates –  kce Aug 2 '11 at 16:23

4 Answers 4

The scale sound about right for NetCat not supporting TCP Windowing. If you do a tcpdump on the interface while the two benchmarks are running I'm guessing you'll see this pattern for NC:

  1. Packet ->
  2. <- Ack
  3. Packet ->
  4. <- Ack
  5. Packet ->
  6. <- Ack
  7. Packet ->
  8. <- Ack

And this pattern for IPerf:

  1. Packet ->
  2. Packet ->
  3. Packet ->
  4. Packet ->
  5. Packet ->
  6. Packet ->
  7. <- Ack
  8. Packet ->
  9. Packet ->
  10. Packet ->
  11. Packet ->
  12. Packet ->
  13. Packet ->
  14. <- Ack
  15. Packet ->
  16. Packet ->
  17. Packet ->
  18. Packet ->
  19. Packet ->
  20. Packet ->
  21. <- Ack

By Windowing TCP segments you can get much higher throughputs since you don't have to wait for the Ack after every packet, only after every segment.

share|improve this answer

It isn't netcat. With iperf I get

[  3] local 192.168.1.201 port 55610 connected with 192.168.1.200 port 5001
[ ID] Interval       Transfer     Bandwidth
[  3]  0.0-10.0 sec   394 MBytes  39.4 MBytes/sec

With nc -l -p 1852 > /dev/null and cat /dev/zero | pv -r | nc 192.168.1.200 1852 I get

[  34MB/s]

(Fluctuates between 30 and 60.)

What data are you feeding netcat?

share|improve this answer

Just because your wireless card is capable of 54mbs connections doesn't mean you are going to get that throughput. In particularly, it sounds like you have 802.11g which has an Achilies heel. As long as *every wireless device it is talking to is also g it will go fast, but as soon as even one device that is only b speed capable, it has to use the lowest common denominator to talk to all devices.

You might try opening a terminal on the machine with wireless and running iwconfig. Look for the Bit Rate= field and see what speed you are actually connected at.

share|improve this answer

Beware about iperf units. This is a common pitfall: iperf often display in Mbit/s instead of Mbyte/s.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.