Re:Show HN: Quickly copy a file between computers
by niggler on Saturday February 16, 2013 @02:12PM
(#5232586)
If you read the `nc` manpage, you'd notice that the -n option on osx and debian disables host lookup and that hostname is defined as
[ Parent
| on HN ]
Re:Show HN: Quickly copy a file between computers
by entropy_ on Saturday February 16, 2013 @02:56PM
(#5232745)
You still need to know the IP. I use nc this exact same way, and it's definitely a hassle -- not a big one, but still -- to have to check ifconfig on one of the machines and then re-input the IP on the other. On internal networks where IPs are assigned by DHCP on connection and can and do change frequently this essentially needs to be done every time you send a file.
I'm not saying that it's such a big hassle that we need complicated ways of avoiding it, but this is definitely a cool project that does a away with a (minor) pain point and I for one applaud the author for scratching his itches and sharing with the world, even if his hack isn't perfect.
Re:Show HN: Quickly copy a file between computers
by niggler on Saturday February 16, 2013 @03:05PM
(#5232784)
nc does this with the broadcast addresses (read https://en.wikipedia.org/wiki/Broadcast_address for more info):
Recipient listens on 0.0.0.0:
recipient$ nc -l 0.0.0.0 6969 > file
Sender broadcasts to broadcast address: sender$ <file | nc 192.168.0.255 6969
or sender$ <file | nc 255.255.255.255 6969
Re:Show HN: Quickly copy a file between computers
by diginux on Saturday February 16, 2013 @03:12PM
(#5232808)
1. In general, I am on the computer I want to send from, then I go to the computer I want to receive on. This script seems to require I be at the receiving computer first. Is there a trick to do it my way?
2. A very minor point, but you are still required to know (or at least specify) a the filename on the receiving end. My solution does not.
Re:Show HN: Quickly copy a file between computers
by niggler on Saturday February 16, 2013 @03:38PM
(#5232920)
To solve both complaints, just tar -c on the ingress and tar -x on the egress:
sender$ tar -c file | nc -l 12345
recipient$ nc addr 12345 | tar -x
This will create a file on the recipient side with the specified name and properties (and you run the sender command first)
Re:Show HN: Quickly copy a file between computers
by diginux on Saturday February 16, 2013 @05:01PM
(#5233198)
Doesn't seem to work for me
sender$ tar -c awesome.jpg | nc -l 0.0.0.0 12345
(waiting forever)
recipient$ nc 255.255.255.255 12345 | tar -x
tar: This does not look like a tar archive
tar: Exiting with failure status due to previous errors