Write own connectionless udp client

Assignment Help Computer Networking
Reference no: EM131199076

You are to write your own connectionless (UDP) client. Print out everything.

You can start with any open-source UDP client as a template and may want to include some parts of the template from Program 1. UDP packets will have the following format:

FM:##_TO:##_ NP:#_HC:#_NO:###_VL:xxx_DATA:xxxxx...

FM - the source address (a number from 1 to 40, 00 as "no name yet" and 99 as "all") TO - the destination address (same range)
NP - number of the protocol

1 = registration request                      2= registration response

3= data                                                4= data confirmation

5= registry dump request                   6= registry dump response

8= serial broadcast          9= serial broadcast confirmation

HC - a count of possible hops remaining (0-9), used only for relaying in Step 5.

NO - a message ID number; you will generate these in order (start with whatever number you want), and match the number in the request to its corresponding response

VL - visited list, a sequence of 2-digit numbers separated by commas that indicates which nodes have already seen this message, e.g., VL:03,04,08,05 - note that VL is empty (VL:_) unless the message has been relayed in Step 5.

DATA - the contents of the message The entire UDP payload can be up to 500 bytes. Underscore (_) indicates a single space.

The # fields indicate decimal numbers; they are exactly as many digits as there are #s above. The xxxx... DATA field indicates text data; it can contain any printable ASCII character and \n. The program should take the following arguments (i.e., see similar values from Program 1):

-s server DNS name or IPv4 address

-p server port number

General instructions and user interface:
Upon starting, your program should:

A. "Register" with the name server (as described in Step 1 below)
B. Run a loop with commands that use the following syntaxes:

REG                                                           (as described in Step 2, below)

UNI_<num>_<string>.                               (as described in Step 3, below)

BRD_<string>.                                           (as described in Step 4, below)

FWD_<num>_VIA_<num>_<string>.        (as described in Step 5, below)

UNI, REG, BRD, FWD, and VIA can be in upper, lower, or mixed case

"_" (underscore) represents one or more blank spaces or tabs (whitespace)

<num> represents a two-digit number, i.e., [0-9][0-9]

<string> represents any sequence of printable asci characters (including spaces and tabs) EXCEPT "."

Print out anything that you receive that is correct. Deal with all errors "gracefully" (as always).

Components to implement (each is worth 1 point):

1. Send a UDP packet to "register" your program

At the start of your program, you need to register to get a (numeric) name. Send a UDP packet to DNS.POSTEL.ORG on port 60450, from your server IP address and port number, and wait up to 2 seconds for a response.

The message should read:

FM:00_TO:01_ NP:1_HC:1_NO:nnn_VL:_DATA:register_me (remember that underscores "_" mean one or more blank spaces) The response will read:

FM:01_TO:00_ NP:2_HC:1_NO:nnn_VL:_DATA:you_have_been_registered_as_## Repeat up to a total of 5 times until you succeed, or stop and report an error.

2. Pull down the registry

When the user requests a registry (by typing "REG"), send a message to DNS.POSTEL.ORG to get the registry map of currently active nodes. Do this up to 5 times until a response is received.

Make sure the FM node number is the one you received when you registered (step 1, above): FM:##_TO:01_ NP:5_HC:1_NO:###_VL:_DATA:GET MAP

The response will be:

FM:01_TO:##_ NP:6_HC:1_NO:###_VL:_DATA:nn=ip@port,nn=ip@port,...

Where "ip" is an IPv4 address, in dotted decimal, and "port" is a port number, in decimal.

There will always be at least one node in the map, but there may be more. The entire list will fit in a single message (the list is YOUR entire list; it may not reflect ALL available nodes).
Print out the received info as a table.

3. Implement a server program to send/receive short messages

Loop waiting for either the user to ask to send a message (the UNI command) or download the registry again or for a packet to arrive.
If a packet arrives with NP:3 that matches your registered address, print it to the screen.

The user indicates they want to send something (e.g., by typing "UNI") followed by a destination (a 2-digit integer from 01 to 99, presumably from the registry you showed them in step 2), and a message ending with ".".

Send the message to the appropriate IP address and port (from the table in Step

2) from your node identifier to theirs: FM:##_TO:##_ NP:3_HC:1_NO:###_VL:_DATA:xxxx...

Send this message up to 5 times until you get a matching response with the FM and TO identifiers swapped with the same NO field and

NP:4 and DATA:OK

If you receive such a message from anyone, send a matching response with the FM and TO identifiers swapped with the same NO field and NP:4 and DATA:OK

4. Serial broadcast

When the user requests to send a broadcast (by typing "BRD"), let them type a message (ending in ".") and send one copy to every node in your registry EXCEPT yourself and the nameserver (01):

FM:##_TO:##_ NP:8_HC:1_NO:###_ VL:_DATA:xxxx...

The FM: address will be your node number, HC: (hopcount) should be set to 1. Send the message up to 5 times until you get a confirmation response with NP:9 from each party or give up (and report that as an error). If you receive such a message correctly, respond by swapping TO and FM identifiers, NP:9, HC:1, and DATA:OK

5. Forwarding

Recall that step 3 will handle messages with NP:3 that are TO: your node number. Augment your code to handle the FWD command, in which you use the first number as the destination in the packet (the TO: field) and the second number as the node to send your packet to first.

Forward NP:3 messages that are NOT TO: you as follows:

- Send a confirmation back to the source (swap TO:/FM: identifiers, NP:4, HC:1, DATA:OK), just as you would for messages that are addressed to you

If HC=0, then print out the message "dropped - hopcount exceeded" (and any message info. for the user).

If HC>0 and your node number IS in the VL list, then print out the message "dropped - node revisited" (and any message info. for the user).

If HC>0 and your node number IS NOT in the VL list, then send a relay copy to 5 nodes selected at random in the registry EXCEPT yourself and the nameserver (with HC decremented by 1, retaining the original TO:/FM: fields, and append ",##" with your node number to VL list)

Reference no: EM131199076

Questions Cloud

Finance goals of investor-owned and not-for-profit : Are there substantial differences between the finance goals of investor-owned and not-for-profit corporations? Explain.
Risk of equal-weighted portfolio : Suppose there are 3 stocks with the same expected return of 10% per year and the same risk (standard deviation) of 50%. The correlation between any 2 of them is 0.5.
Does the marginal productivity of capital diminish : Graph the relationship between output and labor, holding capital constant at its current value. Find the MPN for an increase of labor from 100 to 110. Compare this result with the MPN for an increase in labor from 110 to 120. Does the marginal pro..
Provide reasoning for your response to discussion questions : Please note that this is an MBA course so you must show and demonstrate your ability to provide reasoning for your response to discussion questions.
Write own connectionless udp client : USC EECS450 - Write your own connectionless (UDP) client. Print out everything - Send a UDP packet to DNS.POSTEL.ORG on port 60450, from your server IP address and port number, and wait up to 2 seconds for a response.
Why large medical expenditures be fully tax deductible : Why should casualty losses or large medical expenditures be fully tax-deductible only in certain circumstances?
Problem regarding the fundamental analysis : Explain the market conditions under which fundamental analysis can lead to abnormal return.
Reflect the law of increasing opportunity costs : What assumptions could be changed to shift the production possibilities curve?
In which way flat tax more regressive than present us system : In which way(s) could this flat tax be more regressive than the present U.S. system?-  In which ways could it be more progressive than the present system?

Reviews

Write a Review

Computer Networking Questions & Answers

  Develop the flow diagram of the information and any control

continue working on your proposal.develop the flow diagram of the information and any control elements needed to ensure

  Computing propagation delay of the link

Suppose there is a 10 Mbps microwave link between a geostationary satellite and its base station on earth. What is the propagation delay of the link?

  What information in packet does switch use to find link

When one of these packets arrives to packet switch, what information in packet does switch use to determine link onto which packet is forwarded?

  Discuss the remote connectivity needs for the system

Discuss the remote connectivity needs for the system. Identify the applications and hardware necessary to address the remote connectivity requirements

  It network consultant mainly switches and routers

You have been hired as an IT/ network consultant for a start-up company. The company, " Inetwork", sells used Cisco equipment

  Significant benefits of cloud computing technology

Explain three significant benefits of cloud computing technology. How do these three items benefit the business strategy in the natural world

  What is utc and why is it used

The topics above are linked to each other and the question, they are not independent of each other. They are provided as a minimal guide only. Do not simply write an unconnected paragraph on each without linking the concepts together.

  Benefits of providing text links to graphical links

Question 1.What are some of the benefits of providing text links in addition to graphical links? Question 2.How can we improve on existing websites? Question 3.What are the steps to find the source code?

  Word document that contains a print screen image

Managing switch operations requires a deep knowledge of the spanning tree protocol. Review LabSim modules 7.4, 7.5, and 7.9, which are related to the basic understanding, use, and troubleshooting of the spanning tree protocol.

  What are symptoms of an underperforming network

What are 3 symptoms of an underperforming network. Describe each symptom. How can they be fixed

  Network administrator

Using the library, the Internet, and any other materials, prepare a PowerPoint presentation that outlines the following items

  What business objective does the proposed service

What business objective does the proposed service

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd