top of page

How to Run TCP client using Netcat in Python


Client-server using netcat.


Open two computer terminals:

  • The first will act as the server.

  • The second will be the client.

Syntax:

nc [-options] hostname port[s] [ports]

nc -l -p port [-options] [hostname] [port]

Basic parameters:

-l: set the “listen” mode, waits for the incoming connections.

-p: local port

-u: set the UDP mode

TCP client

With Netcat your PC will act like server

Server:

you want to begin as a server that listens at port 8080:

$ nc -l 8080

In addition, we can use the server to connect to the port (8080) recently opened, from the client side:

client:

$ nc localhost 8080

274 views0 comments

Recent Posts

See All
bottom of page