Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

WRITE USING PYTHON. Write a simple UDP client and server program and a communication protocol using C or python3 in which the client will send

WRITE USING PYTHON.

Write a simple UDP client and server program and a communication protocol using C or python3 in which the client will send a message or a file to the server. Then, the server will reply with the timestamp when it receives the message. The client needs to compute the round-trip-time (RTT) of the sent messages.

Problem:

The message:

  • A string or a file.

The client program takes:

  • The hostname or the IP address of the server is in (argument 1).
  • The port number on the server is in (argument 2).
  • The text/file to send is in (argument 3).
  • The client program name should be client_simple_udp.py or .c
  • client_simple_udp <"Test text"|test_file.txt>
  • E.g.,
    • python3 client_simple_udp.py <"Test text">
    • python3 client_simple_udp.py

The server takes:

  • The port number to listen in (argument 1).
  • The server program name must be server_simple_udp.py or .c
  • E.g.,
    • ./server_simple_udp
    • python3 server_simple_udp.py

Protocol Description

  1. The client creates a checksum of the message.
  2. The client sends both the message and the checksum to the server.
  3. The server receives the message as well as the checksum. It first records the local timestamp when it received the message. The server then prints the date and time, the message, and the received checksum to the screen. Then it calculates the checksum of the received message, prints it, and compares it with the received checksum. If the checksum matches, the server sends the timestamp back to the client. If the checksum does not match, the server reports an error message and acknowledges the client (e.g., value 0).
  4. The client receives the response message from the server. If the message is a valid timestamp, print the date and time; otherwise, report an error message (e.g., print "message failed!"). It also calculates and prints the round-trip-time (RTT), in microseconds, from when it sent the message to when it received the response.

Rules

  1. DO NOT output any debugging information or other informational messages to the screen. Doing so will cost you points!
  2. The program must run on Linux.
  3. The expected output is included in the Example below.

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

PostgreSQL Up And Running A Practical Guide To The Advanced Open Source Database

Authors: Regina Obe, Leo Hsu

3rd Edition

1491963417, 978-1491963418

More Books

Students also viewed these Databases questions

Question

Q.No.1 Explain Large scale map ? Q.No.2 Explain small scale map ?

Answered: 1 week ago