- Published
- Author
- Satya
To understand network sockets locally, you can try this simple demo with two terminal tabs:
1. In the first tab run
2. In the second tab run
Now type text in one terminal and press
#sockets
1. In the first tab run
ns -l 1234 : This starts a small server process that listens for TCP connections on your computer’s address (localhost / 127.0.0.1) at port 1234.2. In the second tab run
ns localhost 1234 : This connects a client to the server on 127.0.0.1:1234 , creating a TCP connection between the two processes.Now type text in one terminal and press
Enter you’ll see the same text appear in the other terminal and vice-versa. 🚀#sockets