I'm using the netcat for unix.
when I run python script.py &> logfile.txt
, it gets captured continuously.
To replicate this remotely, I tried nc -l -p 8011
on the listener (client) and the following for the sender (host or server) :
python script.py &> nc 127.0.0.1 8011
python script.py > nc 127.0.0.1 8011
nc 127.0.0.1 8011 < python script.py
But nothing seems to work. Please help.
Is this what you're after?
Receiver:
Sender:
Make sure to run the receiver code first.
EDIT: In case you're not aware there's a lot of different versions of netcat; they all accept slightly different arguments (e.g.
nc.traditional
on Debian wantsnc -l -p 1234
to listen on port 1234, whereas BSDnc
(e.g. OS X) just wantsnc -l 1234
andncat
may throw an interesting error unless you use the-4
flag if your host doesn't support IPv6) - read the man pages to find out what combination of options you actually want.Perfect answer, with one slight modification: adding -p for "port"
Receiver:
I pulled in the nc help file ( nc -h) using your suggestion
Sender:
I tried
which never worked.
I'm running netcat for Windows 7 in 2 cmd.exe's
Thanks, again