In this task, we will be using UDP as the packetized nature of UDP means that...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
In this task, we will be using UDP as the packetized nature of UDP means that you do not have to worry about finding the start and end of messages in the protocol, the entire message will be encoded in a single UDP packet. Your UDP server will run a permanent loop accepting packets on an open UDP port. Each packet should contain a message in the allowed format according to the protocol specified below. You will be required to: Parse the message to determine if it meets the protocol definition If the message does not match the protocol definition, reply with the error message as per the protocol If the message does meet the protocol definition, reply with a properly formatted acknowledgment response as per the protocol definition Your UDP client will be required to connect to the UDP server and send at least two messages using the protocol definition as described below. Each message must be sent in a unique datagram. You will be required to: Parse replies from the server Print server replies to the screen and extract packet contents Protocol Definition The Protocol is a very simple protocol. All messages are constructed using ASCII text and each message is self-contained within a single UDP datagram The Client has only one message type it can send to the server, the message is an ASCII string formatted as: NE20001: In this message: NE20001: forms the protocol header and must match this value exactly. is an ASCII string containing the data to send to the server. This string is NOT terminated in any way and JUST contains the actual message. must be at least one character long. The Server is responsible for responding to UDP datagrams received on the open port. The Server MUST check the payload of the UDP packet to ensure it matches the valid Client Message as described above. If the received packet is properly formed (contains a properly formed header and a valid ) then the server must respond with a formatted message containing NE20001:A: In this response: NE20001: forms the protocol header and must match this value exactly A: designates the message type as being an Acknowledgement of receipt of the is an ASCII string and must match exactly the message sent by the client. You will be required to extract from the received packet to place into the reply. If the received packet is NOT properly formed, then the server must respond with the message: NE20001:E: In this response: NE20001: forms the protocol header and must match this value exactly E: designates the message type as being an Error message is an ASCII string. You can choose the exact string but this is an error to report back to the user at the client Methodology: Examine the Python UDP socket commands to get an understanding of how to receive and send messages You may wish to examine the following options for Python programming to make your life easier The struct library to pack and unpack messages. This can allow you to combine multiple variables into a single structure (to create a formatted message) and to unpack a message into multiple variables Look at how you can segment Python strings and/or byte objects using indexing (eg, var[:10], var[10:] and var[10:20]) Task: You will need to develop two Python programs. The server program will need to: Open a UDP port Listen for all incoming UDP packets Parse the packet as per the protocol in this document Construct an appropriate response and send it back to the remote system The client program will need to: Create a UDP socket Send at least two properly formatted messages to the server Listen for responses Parse the reply, extracting protocol parameters and display to the screen In this task, we will be using UDP as the packetized nature of UDP means that you do not have to worry about finding the start and end of messages in the protocol, the entire message will be encoded in a single UDP packet. Your UDP server will run a permanent loop accepting packets on an open UDP port. Each packet should contain a message in the allowed format according to the protocol specified below. You will be required to: Parse the message to determine if it meets the protocol definition If the message does not match the protocol definition, reply with the error message as per the protocol If the message does meet the protocol definition, reply with a properly formatted acknowledgment response as per the protocol definition Your UDP client will be required to connect to the UDP server and send at least two messages using the protocol definition as described below. Each message must be sent in a unique datagram. You will be required to: Parse replies from the server Print server replies to the screen and extract packet contents Protocol Definition The Protocol is a very simple protocol. All messages are constructed using ASCII text and each message is self-contained within a single UDP datagram The Client has only one message type it can send to the server, the message is an ASCII string formatted as: NE20001: In this message: NE20001: forms the protocol header and must match this value exactly. is an ASCII string containing the data to send to the server. This string is NOT terminated in any way and JUST contains the actual message. must be at least one character long. The Server is responsible for responding to UDP datagrams received on the open port. The Server MUST check the payload of the UDP packet to ensure it matches the valid Client Message as described above. If the received packet is properly formed (contains a properly formed header and a valid ) then the server must respond with a formatted message containing NE20001:A: In this response: NE20001: forms the protocol header and must match this value exactly A: designates the message type as being an Acknowledgement of receipt of the is an ASCII string and must match exactly the message sent by the client. You will be required to extract from the received packet to place into the reply. If the received packet is NOT properly formed, then the server must respond with the message: NE20001:E: In this response: NE20001: forms the protocol header and must match this value exactly E: designates the message type as being an Error message is an ASCII string. You can choose the exact string but this is an error to report back to the user at the client Methodology: Examine the Python UDP socket commands to get an understanding of how to receive and send messages You may wish to examine the following options for Python programming to make your life easier The struct library to pack and unpack messages. This can allow you to combine multiple variables into a single structure (to create a formatted message) and to unpack a message into multiple variables Look at how you can segment Python strings and/or byte objects using indexing (eg, var[:10], var[10:] and var[10:20]) Task: You will need to develop two Python programs. The server program will need to: Open a UDP port Listen for all incoming UDP packets Parse the packet as per the protocol in this document Construct an appropriate response and send it back to the remote system The client program will need to: Create a UDP socket Send at least two properly formatted messages to the server Listen for responses Parse the reply, extracting protocol parameters and display to the screen
Expert Answer:
Related Book For
Computer Networking A Top-Down Approach
ISBN: 978-0133594140
7th edition
Authors: James Kurose, Keith Ross
Posted Date:
Students also viewed these programming questions
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
Case Study: Quick Fix Dental Practice Technology requirements Application must be built using Visual Studio 2019 or Visual Studio 2017, professional or enterprise. The community edition is not...
-
This scenario is based on thefollowing information: Jo King, aged 58 provided the following information for the year ended 30 June 2023. Table2 - Jo's receipts Receipts $ Net salary (PAYG tax...
-
If a nation exported much of its output but imported little, would it be better or worse off? How about the reverse; that is, exporting little but importing a lot?
-
What is the purpose of having separate categories for index authorization and resource authorization?
-
How can forward exchange contracts be used to manage foreign exchange risk?
-
Chicagos Hard Rock Hotel distributes a mean of 1,000 bath towels per day to guests at t he pool and in their rooms. This demand is normally distributed with a standard deviation of 100 towels per...
-
11. If dy + 2y tan x = sin x, 0
-
Joseph and Diane Smith 1580 West Street Chatham, VA 24531 Joseph and Diane are both 35 and have no dependents. If your clients receive a refund, they want the full amount refunded to them. Diane is...
-
It is preferable to have a higher times interest earned ratio because the company will have more income before interest expense and income tax per dollar of interest expense. Discuss?
-
Discuss two forms of trading costs associated with this currency management strategy. Gupta tells the fund manager of Portfolio B: We need to seriously consider the potential costs associated with...
-
Explain how the hedge, as described by the fund manager, will eventually expose the portfolio to currency risk. Kamala Gupta, a currency management consultant, is hired to evaluate the performance of...
-
The most appropriate price benchmark for the sell order of Music Plus shares is the: A. closing price. B. decision price. C. time-weighted average price (TWAP). Michelle Wong is a portfolio manager...
-
Discuss why Wachos recommended decumulation strategy is the more tax-efficient strategy. Wacho and Ka next discuss tax loss harvesting and tax lot accounting for one of Kas other accounts. Ka has...
-
Compare Statement 1 and Statement 2 and identify which best explains the view of a speculative volatility trader and which best explains the view of a hedger of volatility. Justify your response....
-
What is your opinion? John Martin, director of manufacturing, is not happy with his colleague, Pete Change, who is director of safety and health at Robbins Engineering Corporation. Change has ordered...
-
Chicago Company sold merchandise to a customer for $1,500 cash in a state with a 6% sales tax rate. The total amount of cash collected from the customer was $558. $600. $642. $636. Nevada Company...
-
In CSMA/CD, after the fifth collision, what is the probability that a node chooses K = 4? The result K = 4 corresponds to a delay of how many seconds on a 10 Mbps Ethernet?
-
How arc different RTP streams in different sessions identified by a receiver? How are different streams from within the same session identified?
-
Host A and 13 are directly connected with a 100 Mbps link. There is one TCF connection between the two hosts, and I-lost A is sending to Host B an enormous file over this connection. Host A can send...
-
Is there any information that Shuang could get more easily by interview than by researching secondary sources? If so, what is this information and who would you recommend that she contact?
-
Kaplan gives several examples of the need to clearly explain the cafs purpose and goals. Identify specific assumptions or misconceptions that their audience may have. Why is managing or countering...
-
Do you have any additional tips and tricks you use to organize research results? If so, explain how they would be useful for this project.
Study smarter with the SolutionInn App