Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Programming and Wireshark Exercise: UDP Echo Client and Server (a) Using UDP sockets, you will write a server program that simply echoes back any string

Programming and Wireshark Exercise: UDP Echo Client and Server

(a) Using UDP sockets, you will write a server program that simply echoes back any string that the client process sends it over the network. The client program (UDP-Echo-Client.py) should take the following input parameters:

1) IP address of server

2) IP port of server

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

I.) A message when data is sent to the server indicating destination IP address and port and contents/length of the data sent

II.) A message when data is received from the server indicating source IP address and port and contents of the data received

III.) An error message when any error occurs such as when a time-out occurs because the server is not running, or an invalid port is used

The server program should execute at a fixed port number, and be prepared to read in data of a fixed maximum length (8K)[3]. 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:

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

Test Cases:

Test both client and server running on the same host, such as your computer

Test client behavior under error conditions, such as running client when server is not running, and specifying the wrong port number for the client to use

Test client and server running on different machines (e.g. afsaccess1.njit.edu through afsaccess4.njit.edu)

[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 relevant to programming language you are using. [3] Input parameters may be read in to override these defaults, but this is not necessary.

(b) This wireshark lab is to be used in conjunction with Programming Exercise UDP Echo Client and Server. You can use wireshark to verify that your program is behaving as expected, It may also be helpful in debugging.

Run the UDP Echo client and server on the same host with a packet length of less than 1500 bytes (say 100 bytes). Enable wireshark on the null/loopback interface and capture packets between client and server. Store trace in a .pcap file. When analyzing the .pcap file, specify a filter such that only your application packets are shown in the packet summary window.

Note: Wireshark may misinterpret the data you are sending, and think it is a particular protocol, such as LLC. If something other than UDP is shown in the Protocol column in the Packet Summary window, you can disable analysis of that protocol temporarily by going to Analyze > Enabled Protocols in the menu and unchecking the appropriate protocol.

Questions:

Examine the packet summary window:

Given your program, how many packets is your application client and server sending in total? Verify that this matches with the total number displayed by wireshark

Which packets are being sent by the client? And which by the server? What information would you look at in the packet to verify this?

Select the first packet, and in the packet details window and the packet contents window, examine the information at the application layer (may be called Data in this case).

What is the amount of client data your application is sending? Is this consistent with the length of data shown in wireshark?

What is the content of this data? Is this consistent with the content your application client is sending?

Still selecting the first packet in the packet details window, examine the information at the other layers of the protocol stack below the application layer:

When an application sends a message, it tells the operating system the destination IP address and port. What protocol header is used to store the IP address? What protocol header is used to store the port? Verify this in the wireshark trace.

What is the port of the client? In your application, how is the client port number allocated?

What is the port of the server? In your application, how is the server port number allocated?

Repeat the wireshark capture for the case where only the Echo Client is running, not the Server.

How does the output in wireshark differ from that observed above?

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

Seven Databases In Seven Weeks A Guide To Modern Databases And The NoSQL Movement

Authors: Eric Redmond ,Jim Wilson

1st Edition

1934356921, 978-1934356920

More Books

Students also viewed these Databases questions