I started new connection on port
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?
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.