Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

(choice of Python 3 / Java / C) Using UDP sockets, you will write a client and server program that enables the client to send

(choice of Python 3 / Java / C) Using UDP sockets, you will write a client and server program that enables the client to send a string of some specified length to the server over the network, and the server simply echoes back that string back to the client.

The client program should take the following command-line parameters:

  • IP address of server
  • UDP port of server
  • Length of string to be sent

The client program will read in the above input parameters, initialize a string of the specified length[1], and send the message using the UDP socket API to the server running at the specified IP address and port. If the client does not receive a message back from the server within a certain amount of time (one second), the client should retry up to a maximum number of tries (3) before terminating.[2] The program output should print out trace information when data is sent and received, and account for error conditions. Client trace output must include:

  • A message when data is sent to the server indicating destination IP address and port and length plus content of the data sent
  • A message when data is received from the server indicating source IP address and port and contents of the data received
  • An error message when any error occurs such as when a time-out occurs because the server is not running

The server program should take the following command-line parameters:

  • IP address that server listens on (127.0.0.1 will be used to test the program)
  • UDP port that server listens on (e.g. 12000)

The server will listen on the loopback address and the given port number, and be prepared to receive data from the client up to a fixed maximum length (100 bytes). The server will wait in an infinite loop to receive data from a client, and then send the received data back to the client without modification. Server trace output must include:

  • A message when data is received from the client indicating source IP address and port and contents of the data received

[1] The string may contain any value. Initializing it to a specified value will aid debugging.

[2] The socket API supports a timeout facility. See documentation on socket library relevant to programming language you are using.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle RMAN For Absolute Beginners

Authors: Darl Kuhn

1st Edition

1484207637, 9781484207635

More Books

Students also viewed these Databases questions

Question

Determine the amplitude and period of each function.

Answered: 1 week ago