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

  Describe the three main types of firewalls

Describe the three main types of firewalls. Determine which firewall is the most efficient and why

  Describe how to configure a switch and router in a 350- to

describe how to configure a switch and router in a 350- to 750-word paper in apa format. be sure to include the

  Explain the reasons for your selection

Select a preferred supplier and briefly explain the reasons for your selection - provide the information that you are summarising. Higher marks will be awarded to answers which contain more complete information.

  Design single table to hold all of the information required

Design a single table to hold all of the information required to store an invoice including this information. Next, apply normalization to reduce this table to third normal form.

  The file transfer protocol

The File Transfer Protocol (FTP) uses which transport protocol, TCP or UDP? The PING diagnostic is part of which protocol

  What is the maximum number of hosts it can handle

A network on the Internet has a subnet mask of 255.255.240.0. What is the maximum number of hosts it can handle - What are the values of the header length, total length, identification, flags, and fragment offset fields for all three fragment header..

  What is meant by router interfaces with ssh listening

What is meant by router interfaces with ssh listening on the internet.

  Report on big o as a measure of computational complexity

Develop a report on big O as a measure of computational complexity. What environments use big O as a measure of complexity?

  Disadvantages of using voip

Question: Discuss the advantages and disadvantages of using VOIP and any experience that you have with this protocol.

  What is security forensic

What is security Forensic? How can an organization ensure that personnel does not become part of the security problem.

  Identify the critical path and other paths through network

Construct the project activity network using AON methodology and label each node. Identify the critical path and other paths through the network

  Identify a particular topic relevant to computer networks

You are expected to identify a particular topic relevant to computer networks, investigate the topic through extensive literature search and deep synthesis, and produce a scholarly paper

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