A simple client-server communication script using Python sockets.
server.py: Handles incoming connections and broadcasts messages to all connected clients.client.py: Connects to the server, sends messages, and allows the user to disconnect.
- Run
server.pyto start the server. - Run multiple instances of
client.pyto connect to the server. - Enter messages in the client instances to send them to the server and other connected clients.
- The server listens on a specified port (default: 5050).
- Clients connect to the server's IP address and port.
- Type
!DISCONNECTto disconnect a client. - Type
'q'in the client to quit and disconnect.
- Threading is used to handle multiple client connections simultaneously.
- The communication is based on a fixed message header length.