Hi.
>> Synopsis: Behavior change or regression in netcat from 5.7 > System : OpenBSD 5.7 >> Description: > I noticed netcat from 5.7 was not terminating the connection when I use it > to connect to a simple tcp service (described below). In past versions it ... >> How-To-Repeat: > Make a test service in inetd. 'telnet' was used just to put the service on > port 23. The port used does not affect the outcome. > I used: telnet stream tcp nowait nobody /bin/echo echo "foo" > Then I started inetd by running it manually. > Then I connected to it: > # nc localhost 23 > "foo" > On netcat.c 1.124 and previous, nc then exits and returns to the prompt. > On netcat.c 1.125 and later, it also prints "foo" with a newline but does not > return to the prompt and I have to ctrl-c to exit. I think I reproduced this > behavior with netcat on the sending side with the same result. The behavior > does not seem to change when the output is large such as when I replace echo > with cat of a large (1MB) test file). As already replied privately: This is the intended behavior. Most likely the situation is: You start netcat, input is your stdin, output is the service. Your server (inetd) sends "foo" and then does shutdown of its writing side. Most likely it doesn't blindly close the socket. This is the correct way for a server (inetd can't know echo isn't reading the input). So the server sits there, reads data and throws it away. Netcat also keeps running, because it hasn't seen EOF on your stdin. If you press CTRL-D, nc should close. If you supply the -dN options to netcat this should behave the way you want it to. The case 'echo "bar" |nc -N localhost 23' should also work, i.e. nc should exit. >From a cursory glance, the manpage looks ok. If there are bugs, please say so. - Arne
