Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

UDP server 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 :: pass context data with templateview in django 
Python :: python timer 
Python :: How to Use Python all() Function to Check for Letters in a String using all function 
Python :: domain name of my site 
Python :: int to alphabet letter python 
Python :: huggingface dataset from pandas 
Python :: django createssuperuser 
Python :: python array 
Python :: numpy method to make polynomial model 
Python :: python planet list 
Python :: python longest list in list 
Python :: count elements in columns pandas 
Python :: python winsound 
Python :: hungarian algorithm python 
Python :: # find out indexes of element in the list 
Python :: select all rows in a table flask_ sqlalchemy (python) 
Python :: using a dictionary in python 
Python :: Pandas: How to Drop Rows that Contain a Specific String in 2 columns 
Python :: python package 
Python :: import tsv as dataframe python 
Python :: python file to array 
Python :: urllib download file to folder 
Python :: Django populate form from database 
Python :: loading in pyqt5 
Python :: select multiple dict 
Python :: python print error output 
Python :: import discord python 
Python :: python get local ipv4 
Python :: opencv namedwindow 
Python :: csv len python 
ADD CONTENT
Topic
Content
Source link
Name
6+8 =