4

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.

2 Answers 2

2

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

5
  • 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
    Dec 12, 2013 at 16:38
  • 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. Dec 12, 2013 at 16:43
  • I doubt it has anything to do with netcat itself, probably it's because of differences between the terminal emulators.
    – sashoalm
    Dec 14, 2013 at 11:27
  • 2
    Doesn'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
    Jan 7, 2016 at 9:49
  • Works fine on Linux (Ubuntu 14.04 LTS) Oct 25, 2018 at 19:40
2

This isn't specific to netcat, but on Windows you need Ctrl + Z followed by ENTER to send an EOF.

This is the equivalent of Ctrl + D on a *nix shell.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .