How can I have a netcat connection terminate the sending half of a TCP connection if its input reaches EOF?
I have a (non-standard) TCP service which reads all its input (i.e. until the client sends its FIN), and only then starts processing the data and sending back a reply. I would like to use nc
to interact with this service. But at the moment the reply doesn't arrive at the nc
console, and using Wireshark I can see that nc
only terminates the sending side of the connection when it quits (e.g. because of a timeout). I found no command line option to change this behavior.
Best Answer
The comment by @meuh suggested using
socat
for this purpose. Based on that I've successfully usedTo transfer data including EOF and then still receive the response.