This is a simple client-server UDP socket communication example in Python. It demonstrates communication between a client and a server using User Datagram Protocol (UDP).
Make sure you have Python installed on your system.
-
Clone the repository:
git clone https://github.com/your-username/udp-socket-communication-example.git
-
Navigate to the project directory:
cd udp-socket-communication-example
-
Run the server:
python server.py
-
Run the client in a separate terminal or script:
python client.py
-
Run the server script to start the server listening on a specified host and port.
-
Run the client script, which sends a message to the server and receives a response.
-
Enter a string on the client side, and it will be sent to the server. The server responds with an uppercase version of the message.
-
The communication continues until you decide to exit.
-
server.py
: Contains the server-side code for binding to an address and handling UDP communication. -
client.py
: Contains the client-side code for sending a message to the server and receiving the response.
You can customize the host and port settings in both server.py
and client.py
according to your requirements.
# Example server customization
python server.py --host localhost --port 2000
# Example client customization
python client.py --host localhost --port 2000
This project is licensed under the MIT License - see the LICENSE file for details.
Replace "Youcheng208" in the repository URL, update the file names if needed, and ensure to customize the host and port settings in the examples accordingly.