Question
home / study / engineering / computer science / computer science questions and answers / #UDP Client #Python UDP Client From Socket Import* #python's Socket
home / study / engineering / computer science / computer science questions and answers / #UDP Client #Python UDP Client From Socket Import* #python's Socket Library ServerName = '127.0.0.1'...
Your question has expired and been refunded.
We were unable to find a Chegg Expert to answer your question.
Question: #UDP client #Python UDP Client from socket import* #python's socket library serverName = '127.0.0...
#UDP client #Python UDP Client
from socket import* #python's socket library
serverName = '127.0.0.1' #hostname:127.0.0.1
serverPort = 95950 #pick a random number as well
clientSocket = socket(AF_INET, SOCK_DGRAM) #create UDP socket for server
message = raw_input('Input lowercase sentece:') #get user input
clientSocket.sendto(message,(serverName,serverPort)) #attach server name, port to message; send into socket
modifiedMessage, serverAddress = clientSocket.recvfrom(2048)
print modifiedMessage #print out received string
clientSocket.close() #all close socket
----------------------------------------------------------------------------------------------------------------
#UDP server #Python UDP Server
from socket import*
serverPort = 95950 #match the number with client
serverSocket = socket(AF_INET, SOCK_DGRAM)
serverSocket.bind(('95950', serverPort))
print 'The server is ready to receive'
while 1:
message, clientAddress = serverSocket.recvfrom(2048) modifiedMessage = message.upper() serverSocket.sendto(modifiedMessage, clientAddress) ---------------------------------------------------------------------------------------------------
athena.ecs.csus.edu PuTTY [daij@athena:24]> python server.py The server is ready to receive Server side snapshot athena.ecs.csus.edu PuTTY [daij@athena: 24] python client.py Input lowercase sentence:hello, world! HELLO, WORLD! [daij@athena: 25]> athena.ecs.csus.edu PuTTY [daij@athena:24]> python server.py The server is ready to receive Server side snapshot athena.ecs.csus.edu PuTTY [daij@athena: 24] python client.py Input lowercase sentence:hello, world! HELLO, WORLD! [daij@athena: 25]>Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started