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.


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.

| improve this answer | |
  • 1
    I can confirm I see the same issue on my 10g setup. dd/netcat is reports lower bandwidth as compared to iperf. dd/netcat report about 3Gb/s whereas iperf reports 9Gb/s. – Vince Sep 14 '15 at 17:08
  • Care to check if your guess is correct here? :) – rogerdpack Sep 24 '18 at 18:57
  • My Windows 10 box using netcat was just sending 8KB packets with a TCP window size of only 8KB, resulting in awful performance over gigabit. Happens in both nc and ncat, but SSH gives 90+ MB/sec between the same machines. There is an old bug in windows sockets that causes this: support.microsoft.com/en-us/help/823764/… – Orion Lawlor Mar 2 '19 at 0:33

It isn't netcat. With iperf I get

[  3] local port 55610 connected with 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 1852 I get

[  34MB/s]

(Fluctuates between 30 and 60.)

What data are you feeding netcat?

| 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.

| improve this answer | |

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

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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