netcat EOF (note to self)

background

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

server
nc 9000 <filename
client
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.

solution

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

server
nc -l 9000 <9000
client
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!
…dave
09/30/2017