Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

udp socket 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 :: prevent division by zero numpy 
Python :: how to add a value to a list in python 
Python :: soup itemprop 
Python :: get current domain name django 
Python :: remove space from string python 
Python :: replace list python 
Python :: django superuser 
Python :: python pandas table save 
Python :: how to make a function in python 
Python :: planets python 
Python :: sentiment analysis french python 
Python :: reverse python 
Python :: sample logistic regression parameters for gridsearchcv 
Python :: install anaconda python 2.7 and 3.6 
Python :: find an index of an item in a list python 
Python :: ffill python 
Python :: python square a number 
Python :: if string is in array python 
Python :: python remove lines of string 
Python :: Python check if all elements exist in another list 
Python :: python file to list 
Python :: play sound python 
Python :: matplotlib documentation download via 
Python :: how to make a loading gif in pyqt5 
Python :: discord py message link 
Python :: python dict comprehension 
Python :: import discord 
Python :: get local ipv4 
Python :: online python 
Python :: write the output of a function in a txt file 
ADD CONTENT
Topic
Content
Source link
Name
8+6 =