I started new connection on port 3333 typing nc -l 3333. Then in other terminal window I typed nmap -sT -O localhost to check if 3333 port is really open. After this command my connection on port 3333 ends. That is each time. Can you explain me why it happens?

  • If the existing answer solved your problem, please consider accepting it with the checkmark; thank you! – Jeff Schaller Apr 18 '17 at 10:53

Using nc -l 3333 tells netcat to start listening on port 3333. Once nmap -sT (meaning: scan with TCP Connect) connects, it then disconnects, leaving netcat with nothing to do but exit. You may be interested in nc's -k flag, which says:

Forces nc to stay listening for another connection after its current connection is completed. It is an error to use this option without the -l option.

  • If the -sS (TCP half-open SYN scan) option is given, the connection will not be completed and the listener will still be able to receive a connection. – bonsaiviking Jul 12 '16 at 19:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.