0

How do I actualy use netcat to transfer files over network? IIRC something like that nc -l -p 12345 > destfile(on the receiving end) + dd if=/dev/sourcedevice| nc ipaddress 12345(on the sending end) used to work. That is when the transfer was complete the sending process finished , terminated the tcp connection so the receiving process did quit as well. But now, the sending process just hangs (as if it could transfer anything after EOF) so the receiving process hangs as well. This is totally non scriptable.

I also tried -c on the sending end but that couses the destfile to be of random size (almost the expected size). Or maybe there is some reliable alternative to netcat?

  • Which /dev-device are you using? Could you please add a real example of what is not working? – Patrick B. Feb 10 '13 at 19:51
  • I want to transfer part of /dev/mapper/mainvg-rootlv. But it really makes no difference as the point is that netcat does not react to EOF (no matter if it is a real file, part of a file, or Ctrl-D from keyboard). – Tomasz Grobelny Feb 12 '13 at 10:29

1 Answers1

1

What I always do is:

nc -l -p 12345 > destfile
nc ipaddress 12345 < sourcefile
Lucas Kauffman
  • 16,880
  • 9
  • 58
  • 93