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

#PythonTCP #pythonNetcat #runyourownserverusingnetcatinpythontcp

Contact Us

Tel: (+91) 0120  4118730  

Time :   10 : 00  AM -  08 : 00 PM IST 

Registered address: G-69, Sector 63, 

 Noida - 201301, India

We Provide Services Across The different countries

USA    Australia   Canada   UK    UAE    Singapore   New Zealand    Malasia   India   Ireland   Germany

CodersArts is a Product by Sofstack Technology Solutions Pvt. Ltd.

  • CodersArts | Linkedin