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) ---------------------------------------------------------------------------------------------------

home / study / engineering / computer science / computer science questions

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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!