I use Netcat once in a while to copy files or disk images over the network. While it does the job I always felt like it was always on the slow sluggy side regardless of using ssh, no ssh, compression or no compression.
I have started testing out udpcast (http://www.udpcast.linux.lu/cmd.html) and it seems to be at least 5 times (or more) faster. Udpcast with compressed pipes are sometimes many times faster than netcat with no compressed pipes.Compression with Nc is generally slows down over my local network so I generally avoid it. Because my network is generally running at 1gbs
Here are couple examples without ssh and no compression I use
dd if=somedisk |pv|nc -l -p 9999
nc networkaddr 9999|pv >./disk.img
udp-sender --full-duplex --file /dev/somedisk
udp-receiver --file ./disk.img
These are some basic examples I use. Naturally I use compressed pipes too. In all cases udpcast will out perform min 5x speeds Netcat and I am wondering about why that is the case.
I am even inclined to think that Udpcast with pipes is good compliment for network file transfer.
Here udpcast with tar and untar pipe for 17.5 GiB over the network
real 9m26.186s
user 0m1.247s
sys 0m23.836s
And here is cp over Samba from Linux to Windows
real 9m17.729s
user 0m0.311s
sys 0m11.044s
Is it possible to catch the Udpcast performance with Netcat?
The reason I am asking sometimes some distro might now offer Udpcast.
nc
by default uses TCP.
TCP starts with a low "window size" and gains speed during a connection as the maximum window size is determined to be larger. In addition, TCP sends extra traffic to maintain connections, i.e. ACK packets. This is necessary to support the notion of a "connection" and reliable, ordered delivery.
UDP doesn't support connections or reliable delivery so none of that extra baggage exists and thus it is faster.
I have not played with udpcast
much but if it doesn't have any error detection mechanisms then you risk not having a good copy of what you transmitted if your network decides to drop a packet.
nc
has a -u
option IIRC to send/receive using UDP instead of TCP.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments