SHARE
SPREAD
HELP

The Tradition of Sharing

Help your friends and juniors by posting answers to the questions that you know. Also post questions that are not available.


To start with, Sr2Jr’s first step is to reduce the expenses related to education. To achieve this goal Sr2Jr organized the textbook’s question and answers. Sr2Jr is community based and need your support to fill the question and answers. The question and answers posted will be available free of cost to all.

 

#
Authors:
James F. Kurose, Keith W. Ross
Chapter:
Application Layer
Exercise:
Problems
Question:32 | ISBN:9780132856201 | Edition: 6

Question

Suppose that in UDPClient.py, after we create the socket, we add the line: clientSocket.bind(('', 5432))

Will it become necessary to change UDPServer.py? What are the port num- bers for the sockets in UDPClient and UDPServer? What were they before making this change?

TextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbook

Answer

Refer chapter 2, section 2.7.1 of textbook for complete code of the UDPClient.py :

Moidfied code:

from socket import *
	.
	.
	#write the remaining code here
	.
	.
clientSocket = socket(socket.AF_INET, socket.SOCK_DGRAM)
clientSocket.bind((‘ ’, 5432))
message = raw_input(‘Input lowercase sentence:’)
	.
	.
	#write the remaining code here
	.
	.
clientSocket.close()

After modifications then the Port numbers of client and server:

DP Client port number         - 5432

UDP Server port number        - 12000

Before modifications the Port numbers of client and server :

UDP Client port number         - xxxx (number assigned by OS)

UDP Server port number        - 12000

0 0

Discussions

Post the discussion to improve the above solution.