Implement a transport layer protocol to transmit data

Assignment Help Computer Networking
Reference no: EM13887268

In this project, you will implement a Transport Layer protocol to transmit data with Reliable Data Transfer from a client (Sender) to a server (Receiver) in the presence of channel errors and loss. The protocol to be implemented by you is the Go-Back-N protocol. The protocol will be unidirectional in which data is sent in one direction only (client to server) with acknowledgements being sent in the reverse direction (server to client). Only positive ACKs are used. The transmission of packets will be done over UDP (that represents an unreliable network layer channel) using fixed UDP ports.

To implement this protocol, you will write two separate programs called client and server which represent the actions to be executed by the sending and receiving nodes respectively. Both the client and the server will run on orioles.

Packet Formats

The format of a data packet is shown in the figure below.  Each data packet contains a 4-byte   long header followed by a number of data characters. The header contains 2 fields, each of length 16 bits (2 bytes) as shown in the figure. You must convert the values in these fields into the network byte order when they are transmitted, and convert them back to host byte order when they are received.

The first field of the header is a count of the number of data characters in the packet. This value must be in the range 0 through 80. If the count is 0, then there are no data characters in the packet.

<----------------- 16 bits (2 bytes) ------------------>

--------------------------------------------------------

|              Count (no. of data bytes)             |

--------------------------------------------------------

|               Packet Sequence Number              |

--------------------------------------------------------

|            Data Bytes     |          ...            |

--------------------------------------------------------

The second field of the header is the packet sequence number. Each packet transmitted by the client is assigned a sequence number in the range 0 through 15.

The format of an acknowledgement packet that is returned from the server to the client is shown in the figure below:<----------------- 16 bits (2 bytes) ------------------>
--------------------------------------------------------
| ACK Sequence Number |
--------------------------------------------------------

Acknowledgements are transmitted (from the server to the client) as separate packets of fixed length, 2 bytes. The first and only field of the ACK packet is the ACK sequence number, which may be in the range 0 through 15. This is the sequence number of the data packet being acknowledged by this ACK.

Once again, you must perform the conversion between network and host byte orders on both the transmitting and receiving ends.
General Actions

The server starts by printing out its port number. It then prompts the user to enter some configuration parameters (see later section for details). It then waits for data packets to arrive from the client.

The client starts by prompting the user to enter the hostname and port number for the server. It then prompts the user to enter the name of the file to be transferred. Next the client prompts the user to enter some configuration parameters (see later section for details).

The client then reads the input file and sends it to the server in a series of packets as described below. The server receives the file and stores it with the name out.txt. When the file transfer is complete, both the client and the server terminate execution.

The client constructs packets by reading lines one at a time from the input file. Each line in the input file contains a sequence of printable characters (no control characters, etc.), with no more than 80 characters on a line. The "newline" character read from the file at the end of each line is also transmitted in the packet and is included within the limit of 80 characters per line. You should note that the "newline" character is not the same as the "null" character used by C as a string terminator. You should not include any "null" characters in the line to be transmitted in a packet.

The client transmits each line to the server in a separate packet. The server receives the packets and puts their data into distinct lines in the output file. You must make sure that duplicate packets are discarded and do not get their data stored in the output file.

When the client is finished transmitting all the lines in the data file, and has received ACKs for all of them, it will send a special last packet called EOT signifying "End of Transmission". This packet will have a Count of 0 and no data characters. It will have a Sequence Number that is the next sequence number that would have been used if this were a valid data packet. It is important that this packet be transmitted only after the client has received ACKs for all transmitted data packets. The server will not transmit an ACK for the EOT packet, and the client will not expect any ACK to be returned for it. The client program can terminate once this packet has been transmitted. When the server receives the EOT packet, it closes the output file and also terminates.

Go-Back-N Protocol

Follow the general description of the Go-Back-N protocol studied in class (also in Figures 3.20 and of your textbook) to design the actions executed by your programs. In addition, use the loop structure for the actions of the client and server described in Lecture Notes Topic 3, Part 3, page 5 of the handout (Go-Back-N: General Implementation).

There are two significant departures from the above protocol in your implementation:

• How you handle the "Call from above" represented by the rdt send(data) function: If the client's window is not full, instead of waiting for the user above to call your protocol machine, you should call a function that reads the next line from the input file and hands it to you as the data to be transmitted in the next packet.

• Checksum: Your packet format does not have a checksum, and your data packets and ACKs are not going to carry a checksum. Thus you will not be doing any checksum computation, nor checking the received packets to see if there are any errors. Thus, the function make pkt will not have a checksum parameter, and you will omit the calls to the functions corrupt and notcorrupt in your code.

Client Actions

Because the client must check for timeouts as well as check for incoming ACKs, it must not block on the read function call if there is no ACK in the input buffer. For this reason, the reading of an incoming packet must be done in a non-blocking fashion. Thus, if there is no incoming ACK available, the read function should not block, but should instead return without reading so you can continue in the loop to check if a timeout has occurred. Use the nonblocking version of the UDP client for your implementation.

The sequence number of successive packets transmitted by the client must range from 0 through 15 and then wrap-around to 0. This is true no matter what window size is being used. It is acceptable if you use a buffer of size 16 to store the queue of unACK'ed packets.

Timeout:

The client needs to start a timer when a data packet is transmitted. A single timer should be used for this purpose (as in the FSM given in your textbook). The semantics of this timer can be tricky, so make sure you understand exactly when the timer needs to be started, cleared, or restarted.

It is sufficient for your purpose to have a simple synchronous implementation of the timer. In this implementation, you can find the current time with a microseconds resolution using the gettime- ofday() function. Pay close attention to the structure returned by this function; both fields of this structure must be used. To start the timer, you can set a timer variable to the time at which the timer should expire (the current time plus the timeout interval). In each loop iteration, you can get the current time and compare with the time stored in the timer variable to decide

whether or not the timer has expired. Be aware of the following pitfalls in using the time structures:• You must use both the seconds and microseconds parts of the time structure; using only one of them is not acceptable.

• You should not combine the values of the seconds and microseconds parts into a single time value. Since each of the parts is a long integer, combining them together may result in an overflow and loss of information, which may cause strange behavior of the client.

• To add, subtract, or compare two time structures, always do the operation on each component (seconds or microseconds) separately, and then deal appropriately with any carry or borrow that results.

Server Actions

The server also runs in a loop; however, it can use the regular blocking version of the server pro- gram. In addition to the server actions for the Go-Back-N protocol, we will introduce one additional function: simulating loss, errors, and delay. We will need to do this because UDP clients and servers running on the same host will almost never see such behavior.
The actions of the server will be as follows:

• Start server loop.

• Wait for packet to arrive from client.

• If packet is received, check if Count field in packet is 0. If it is 0, this signifies an EOT packet, so quit loop.

• If packet is received, but Count field is not 0, this is a regular data packet. In this case, call the simulate function described below to simulate loss, errors, and delay.

• If simulate returns 0, then packet is lost or has errors; discard packet and return to start of loop.

• If simulate returns 1, then packet is correct. Process the packet according to the protocol actions of the Go-Back-N protocol. Generate an ACK if required.

• After ACK is generated, call the function ACKsimulate to simulate ACK loss.

• If the function ACKsimulate returns 0, the ACK is lost, and is not transmitted. If the function returns 1, then transmit the ACK.

• End of loop.

Reference no: EM13887268

Questions Cloud

Find the average and standard deviation : Two normal unbiased six-faced dice A and B are rolled alternately starting with A ; if A shows a 6 the experiment ends. If B shows an odd number no points are scored, if it shows a 2 or a 4 then one point is scored, whilst if it records a 6 then t..
Ductile material that begins to neck in tension : Consider a very ductile material that begins to neck in tension at a true strain of 0.20. Necking causes an additional elongation that is approximately equal to the bar diameter.
Randomly select and examine an individual return : In 2006 the U.S. Internal Revenue Service (IRS) received 132,275,830 individual tax returns (The 2008 New York Times Almanac). The actual number of each type of individual return received by the IRS in 2006 is given below:
Asymptotes of the below function : Find the maximum and minimum, changes in concavity, intervals of increasing and decreasing, and asymptotes of the below function.y = xex
Implement a transport layer protocol to transmit data : In this project, you will implement a Transport Layer protocol to transmit data with Reliable Data Transfer from a client (Sender) to a server (Receiver) in the presence of channel errors and loss
What would be the mode in this set of numbers : What would be the Mode in this set of numbers? 2, 2, 0, 5,1, 4,1, 3, 0, 0, 1, 4, 4, 0,1, 4, 3, 4, 2, 1
List and describe the different channels : List and describe the different channels that banks use to deliver banking services. For each, describe the characteristics of the customers who will likely be active users of services in that channel.
Use the data to compute the ten residuals : 1.  A researcher interested in the relationship between body mass index (BMI) and total serum cholesterol wished to fit a simple linear regression model in which total serum cholesterol is predicted from BMI using the following data. Use the data to..
Calculate the applied shear stress : Calculate the applied shear stress, τ (relative to G), which is necessary to bow the dislocations between particles. Would dislocations bow between the particles or shear them?

Reviews

Write a Review

Computer Networking Questions & Answers

  Write a 200- to 300-word response to the following nbspwhat

voice over the internet protocol voip. nbspwhat is voip and how is it different from the plain old telephone service

  Question 1 write a technical description of the functions

question 1 write a technical description of the functions which are available on a workstation for new students who may

  Define throughput in regards to wireless network

Define 'throughput' in regards to wireless network. Use a practical method (e.g., using an software) to measure throughput of a wireless network? You should provide any appropriate screenshots.

  1 we are building a network using radios that operate at

1. we are building a network using radios that operate at 1ghz in an urban area.nbsp once end of the link will have the

  Define social media and networking technologies

Analyze how the university might integrate at least two social media and networking technologies to accomplish their goals. Your analysis must cover the advantages and disadvantages of social networking. The president of the university also needs ..

  System analyst and design-business process-functional model

Advanced Business Systems (ABS) is a consulting and staffing company providing specialized staffing and consulting services to clients in a variety of different industries. It has offices in major U.S. metro areas and has ongoing relationships wit..

  Which of following is not class of client-server processing

Retail point of sale systems are an example of horizontal partitioning of data processing.

  Determine possible routing paths in bgp routing table

In the topology, network S is multi-homed to four providers, i.e., P1, P2, P3 and P4, where P1, P2 and P3 are customers of common provider P while P4 is customer. Now assume D is destination of interest. Determine the possible routing paths to D th..

  Design the new addressing scheme for the network

Strategy to upgrade the company's current infrastructure to support the new employees and recommend one strategy to create a high-performance network

  Define networks and hardware in personal computers

From the e-Activity, determine whether you prefer a laptop or desktop. Elaborate on the features that you would want your desktop or laptop to offer, and provide an explanation of why you would want such features.

  Slowness of network

ABC Corporation designs web sites and has been facing the following network problems for the past one month: Slowness of network and Poor application response time

  Analyze the new system and determine the design issues

Analyze the new system and determine the design issues with this new system.

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