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

  Determine the root cause of the problem

Your team has been tasked to determine the root cause of this problem. The analysis should begin by taking a holistic view of the network diagram to understand the topology.

  You were tasked to handle the urgent delivery

You were tasked to handle the urgent delivery of 10TB of data from your company in Washington, D.C to a subsidiary in San Francisco, CA (2,815 miles away).

  Computer network security for a home

Assignment No. 1: Computer Network Security for a Home/Small scale Network.Learning outcomes:1. Identify the various threats and risks in a small scale network2. Describe and compare a number of different techniques to secure a network3. Analyse, eva..

  How the equation will be used step by step

Draw a simple graph to show conflict degree. Use channels as colors and show the algorithm step by step to color the graph. Explain what does thismean i.e. what have you constructed?

  How big is the mac address space

How big is the MAC address space? The IPv4 address space? The IPv6 address space?

  Explaining protocol to avoid defeat

Is there any protocol which you and Luke can use to avoid defeat? If not, describe why not. If there is protocol that would work, describe it.

  Create variant of kerberos in which workstation generate tgt

Create variant of Kerberos in which the workstation generates TGT. TGT will be encrypted with user's master key rather than KDC's master key.

  Divide the network whose cidr address

Divide the network whose CIDR address is 165.221.204.0/25 into three subnets, with one subnet having half the addresses and the other two subnets having a quarter of the addresses each. Give the CIDR address of each subnet. How many addresses are ..

  1nbspnbspnbsp find the solution of the

1.nbspnbspnbsp find the solution of the systemxnbspnbspnbspnbspnbspnbspnbspnbspnbspnbspnbspnbspnbsp 1 mod

  Describe how to modify a nat router to prevent packets

Describe how to modify a NAT router to prevent packets with spoofed IP addresses from exiting a private network.

  Describe different quality activities involved in project

Describe the different quality activities involved in this project and each of their outcomes. Describe Pareto diagrams and their use in project management.

  Can you compute the betweenness values of all of the edges

Can you compute the betweenness values of all of the edges from these data? Which edge of the graph would the GirvanNewman method for graph partitioning remove first?

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