How to create a TCP connection using nc
which listens to multiple hosts?
nc -l -p 12345
Simultaneous connections are not possible with netcat . You should use something like ucspi-tcp 's tcpserver tool or leverage xinetd since you're on Linux. Consecutive connections could be handled through a shell script that restarts netcat after it finishes.
You also can use Netcat/nc to scan multiple ports. The syntax is the same as shown previously; just add a space and the ports you want to scan, as shown in the example below in which ports 80, 22, and 53 are scanned.
On one machine, you can tell netcat to listen to a specific port for connections. We can do this by providing the -l parameter and choosing a port: netcat -l 4444.
Simultaneous connections are not possible with netcat
. You should use something like ucspi-tcp
's tcpserver
tool or leverage xinetd
since you're on Linux.
See: https://superuser.com/questions/232747/netcat-as-a-multithread-server
Consecutive connections could be handled through a shell script that restarts netcat
after it finishes.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With