Skip to content

A simple Python UDP server that receives messages from clients in a background thread and allows server-side message sending via the console.

License

Notifications You must be signed in to change notification settings

zared1/Simple-UDP-Server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

Simple UDP Server

This is a basic Python UDP server that listens for incoming datagrams and prints messages received from clients. It runs a listener in a separate thread and allows the server operator to send messages via the console. The current implementation sends messages back to the server address (for demo/testing purposes), but can be extended to respond to actual client addresses.

Features

  • Uses UDP sockets (socket.SOCK_DGRAM)
  • Listens for incoming messages in a separate thread
  • Prints received messages from clients
  • Allows sending messages from server console

How to Run

  1. Clone or download the repo.
  2. Run the server script:
python server.py
  1. Connect with a UDP client like nc (netcat):
nc -u localhost 10000
  1. Type messages in the client to send them to the server.
  2. Type messages in the server console to send messages (currently sent to localhost:10000, can be modified to respond to clients).

Notes

  • The server uses UDP, which is connectionless — there are no persistent client connections.
  • Messages from clients are printed in the console along with their address.
  • Currently, messages sent from the server go to its own address (localhost:10000); you can update the code to store and respond to client addresses dynamically.
  • You can enhance the server by keeping a list of client addresses and sending replies back to them individually or broadcasting.

About

A simple Python UDP server that receives messages from clients in a background thread and allows server-side message sending via the console.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages