netcat EOF (note to self)


back in the day, one could whip up a quick file copy service a couple of seconds with something like this:

nc 9000 <filename
nc server 9000 >filename

the file copied, and the processes on both ends terminated gracefully.

the problem

nowadays, however, netcat has changed so that the invocations above will not terminate when the transfer comletes. also, one must add another argument to the server’s command line to tell it to listen instead of trying to connect.


most versions of netcat that I’ve seen lately; mostly on *BSD, and hence, darwin, now require extra command line switches. to wit:

nc -l 9000 <9000
nc -N server 9000 >filename

this probably appies to linux and cygwin, too, but i haven’t had call to try it on one of those in quite a while.

that’s all folks!