Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

How to develop a UDP echo server in python?

"""
UDP echo server that converts a message
received from client into uppercase and
then sends it back to client. 
"""
from socket import *
# Port number of server
server_port = 12000
# Server using IPv4 and UDP socket
server_socket = socket(AF_INET, SOCK_DGRAM)
# Bind server to port number and IP address
server_socket.bind(("127.0.0.1", server_port))
print("The server is ready to receive msg...")
while True:
    # Extract message and client address from received msg
    message, client_address = server_socket.recvfrom(2048)
    # Create response message
    modified_message = message.upper()
    server_socket.sendto(modified_message, client_address)
Comment

PREVIOUS NEXT
Code Example
Python :: numpy divide with exception 
Python :: append to list py 
Python :: python program to check if binary representation is a palindrome 
Python :: How to send Email verification codes to user in Firebase using Python 
Python :: subset a list python 
Python :: replace list 
Python :: how to create an array in python 
Python :: pandas remove outliers 
Python :: python replace 
Python :: planets with python coding 
Python :: queue using linked list in python 
Python :: drop row with condition dataframe 
Python :: Iniciar servidor en Django 
Python :: python split input to list 
Python :: cors python 
Python :: ffill dataframe python 
Python :: legend text color matplotlib 
Python :: __delattr__ python 
Python :: how to find unique values in list in python 
Python :: drop first column read_csv 
Python :: create custom exception python 
Python :: python script that executes at time 
Python :: find pdf encrypted password with python 
Python :: python verify if string is a float 
Python :: python logging to syslog linux 
Python :: progress bar python text 
Python :: get number of key in dictionary python 
Python :: get local ip 
Python :: is tuple immutable in python 
Python :: determinant of matrix in python 
ADD CONTENT
Topic
Content
Source link
Name
4+5 =