A simple, safe, and robust TCP Echo Server written in native Python. This project is a great foundational example for learning network programming and socket handling.
- Listens on
localhost:8080(TCP) - Gracefully handles client connections and disconnections
- Immediately releases the bound port on exit using
SO_REUSEADDR - Safely echoes received data back to the client without executing system commands
Run the script in your terminal to start the server. It will begin listening on port 8080.
python simple.pyOpen a new terminal window and connect to the server using netcat (or telnet).
nc 127.0.0.1 8080Once connected, anything you type into the netcat terminal will be sent to the server and safely echoed right back to you.
To stop the server, press Ctrl+C in the terminal where it is running.