Netcat: Should I use Ctrl+C to close the connection?

3

I've opened netcat, and I'm entering things from the keyboard. When I've finished and I want to close the connection, should I just hit "Ctrl+C"?

I want the connection to be closed "normally", but I have no idea if Ctrl+C does that, or if it closes it "abnormally", and I have no idea how else to close the connection from the keyboard.

sashoalm

Posted 2013-12-12T16:01:35.777

Reputation: 2 680

Answers

1

To close the connection press Ctrl + D, which is in practice an EOF

fede.evol

Posted 2013-12-12T16:01:35.777

Reputation: 1 718

1Doesn't work. I understand that Ctrl+C and Ctrl+D are terminal signals in Unix/Linux and netcat simply handles them on a different channel than user input. But this question is specifically about Windows that doesn't generate these signals. So another solution needs to be found. – ygoe – 2016-01-07T09:49:06.820

Works fine on Linux (Ubuntu 14.04 LTS) – Gabriel Staples – 2018-10-25T19:40:19.137

Hm, that didn't work. Netcat didn't stop, and the connection wasn't closed. Maybe it's because I'm on Windows? Does it work for you? – sashoalm – 2013-12-12T16:38:59.417

Ctrl+d is the correct way to close netcat in the *Nix world. Funny it should be different on Windows, considering it is a port anyway. – MariusMatutiae – 2013-12-12T16:43:23.830

I doubt it has anything to do with netcat itself, probably it's because of differences between the terminal emulators. – sashoalm – 2013-12-14T11:27:04.150