First layer. The UDP header consists of four

First of all, in the project, I cannot use any transport protocol libraries, such as TCP. Therefore, I construct the packets and acknowledgements, and interpret the incoming packets by myself.

A datagram is a basic transfer unit associated with a packet-switched network. Datagrams are typically structured in header and payload sections. Datagrams provide a connectionless communication service across a packet-switched network.

We Will Write a Custom Essay Specifically
For You For Only $13.90/page!

order now

The delivery, arrival time, and order of arrival of datagrams need not be guaranteed by the network.subsection{Design the packet format} Like in Project 1 I need to design fields for packet type, ACK number, window size, data etc. A UDP datagram is carried in a single IP packet and is hence limited to a maximum payload of 65,507 bytes for IPv4 and 65,527 bytes for IPv6. The transmission of large IP packets usually requires IP fragmentation. Fragmentation decreases communication reliability and efficiency and should therefore be avoided.To transmit a UDP datagram, a computer completes the appropriate fields in the UDP header (PCI) and forwards the data together with the header for transmission by the IP network layer.

The UDP header consists of four fields each of 2 bytes in length:Source Port, Destination Port, UDP length, and UDP Checksum.subsection{Design the Reliable transmission}The Reliable transmission has to Handle lost packets, and Ensure data is delivered in order.UDP is an unreliable transport system used to transfer data between machines. When data is sent, the only thing that is guaranteed is the packet was sent out on the wire. Any reliability checking needs to be done at the application layer. Also, UDP preserves message boundaries set by sends, i.

e. if send is called twice with data sizes 1000 and 2000 then two packets will be sent of sizes 1000 and 2000. If send is called with a data size larger than the MTU value, the packet will be fragmented. If the data that we are trying to send is such that we can tolerate the loss of a single packet. For instance, regularly sampled data where the sampling rate is many times higher than the bandwidth of the signal, as our 10 Mb txt data. Then we can probably sacrifice some reliability of transmission by ensuring that we can detect data corruption.

 section{ different configurations of netem}Network emulation is a technique for testing the performance of real applications over a virtual network. This is different from network simulation where purely mathematical models of traffic, network models, channels and protocols are applied. The aim is to assess performance, predict the impact of change, or otherwise optimize technology decision-making.NetEm is an enhancement of the Linux traffic control facilities that       allow to add delay, packet loss, duplication and more other       characteristics to packets outgoing from a selected network       interface.              Delay adds the chosen delay to the packets outgoing to chosen network       interface.

The optional parameters allows to introduce a delay       variation and a correlation.  Delay and jitter values are expressed       in ms while correlation is percentage.       Distribution       allows the user to choose the delay distribution. If not specified,       the default distribution is Normal. Additional parameters allow to       consider situations in which network has variable delays depending on       traffic flows concurring on the same path, that causes several delay       peaks and a tail.              Packet loss occurs when one or more packets of data traveling across a computer network fail to reach their destination.

Packet loss is typically caused by network congestion. Packet loss is measured as a percentage of packets lost with respect to packets sent.       section{the efficiency of the protocol }I was tring different configurations of the network by changing: as Delay distribution, Packet loss rate, Packet duplication rate, Packet re-ordering rate. For example,/sudo tc qdisk add dev eth0 root netem delay 100ms 20ms 25\% loss 0.

5\% duplicate 1\% reorder 25\% 50\%/This configuration says: Delay is 100ms ± 20ms with the next random element depending 25\% on the last one;  Packet loss rate is 0.5\%;  Packet duplicate rate is 1\%;  25\% of packets (with a correlation of 50\%) will get sent immediately, others will be delayed; Also, my program needs to handle file of any size. I created a file with name file.

txt size of 10MB. subsection{the throughput}The sender in Stop and Wait sends one packet every RTT, so the maximum throughput is exactly that. The good thing about this protocol is that it is very simple, and should be used under two circumstances: first, when throughput isn’t a concern and one wants good reliability, and second, when the network path has a small RTT such that sending one packet every RTT is enough to saturate the bandwidth of the link or path between sender and receiver.On the other hand, a typical network path between Boston and San Francisco might have an RTT of about 100 milliseconds.

If the network path has a bit rate of 1 megabit/s, and we use a packet size of 10,000 bits, then the maximum throughput of stop-and-wait would be only 10\% of the possible rate.The receiver in Go back N is almost exactly the same as in the stop-and-wait case, except that it must also buffer packets that might arrive out-of-order so that it can deliver them in order to the receiving application. This addition makes the receiver a bit more complex than before, but this complexity is worth the extra throughput in most situations.

 In Go back N protocol, the window slides every time the sender gets an ACK. The reason is that the receipt of an ACK is a positive signal that one packet left the network, and so the sender can add another to replenish the window. %subsection{the delay}section{Compare Retransmission protocol}subsection{Stop-and-Wait}Stop-and-wait ensures that information is not lost due to dropped packets and that packets are received in the correct order. It is the simplest automatic repeat-request (ARQ) mechanism. A stop-and-wait ARQ sender sends one frame at a time; it is a special case of the general sliding window protocol with transmit and receive window sizes equal to one and greater than one respectively.

After sending each frame, the sender doesn’t send any further frames until it receives an acknowledgement (ACK) signal. After receiving a valid frame, the receiver sends an ACK. If the ACK does not reach the sender before a certain time, known as the timeout, the sender sends the same frame again. The timeout countdown is reset after each frame transmission. The above behavior is a basic example of Stop-and-Wait. However, real-life implementations vary to address certain issues of design.

Typically the transmitter adds a redundancy check number to the end of each frame. The receiver uses the redundancy check number to check for possible damage. If the receiver sees that the frame is good, it sends an ACK. If the receiver sees that the frame is damaged, the receiver discards it and does not send an ACK—pretending that the frame was completely lost, not merely damaged.One problem is when the ACK sent by the receiver is damaged or lost. In this case, the sender doesn’t receive the ACK, times out, and sends the frame again. Another problem is when the transmission medium has such a long latency that the sender’s timeout runs out before the frame reaches the receiver. In this case the sender resends the same packet.

Eventually the receiver gets two copies of the same frame, and sends an ACK for each one. The sender, waiting for a single ACK, receives two ACKs, which may cause problems if it assumes that the second ACK is for the next frame in the sequence.To avoid these problems, the most common solution is to define a 1 bit sequence number in the header of the frame. This sequence number alternates (from 0 to 1) in subsequent frames. When the receiver sends an ACK, it includes the sequence number of the next packet it expects.

This way, the receiver can detect duplicated frames by checking if the frame sequence numbers alternate. If two subsequent frames have the same sequence number, they are duplicates, and the second frame is discarded. Similarly, if two subsequent ACKs reference the same sequence number, they are acknowledging the same frame.Stop-and-wait ARQ is inefficient compared to other ARQs, because the time between packets, if the ACK and the data are received successfully, is twice the transit time. The throughput on the channel is a fraction of what it could be.

To solve this problem, one can send more than one packet at a time with a larger sequence number and use one ACK for a set. This is what is done in Go-Back-N.After transmitting one packet, the sender waits for an acknowledgment (ACK) from the receiver before transmitting the next one. In this way, the sender can recognize that the previous packet is transmitted successfully and we could say “stop-n-wait” guarantees reliable transfer between nodes. To support this feature, the sender keeps a record of each packet it sends. Also, to avoid confusion caused by delayed or duplicated ACKs, “stop-n-wait” sends each packets with unique sequence numbers and receives that numbers in each ACKs.

 If the sender doesn’t receive ACK for previous sent packet after a certain period of time, the sender times out and retransmits that packet again. There are two cases when the sender doesn’t receive ACK.To support this feature, the sender keeps timer per each packet.

 subsection{Go-Back-N}On the other hand, Go-Back-N ARQ is a specific instance of the automatic repeat request (ARQ) protocol, in which the sending process continues to send a number of frames specified by a window size even without receiving an acknowledgement (ACK) packet from the receiver. It is a special case of the general sliding window protocol with the transmit window size of N and receive window size of 1. It can transmit N frames to the peer before requiring an ACK.The receiver process keeps track of the sequence number of the next frame it expects to receive, and sends that number with every ACK it sends. The receiver will discard any frame that does not have the exact sequence number it expects and will resend an ACK for the last correct in-order frame. Once the sender has sent all of the frames in its window, it will detect that all of the frames since the first lost frame are outstanding, and will go back to the sequence number of the last ACK it received from the receiver process and fill its window starting with that frame and continue the process over again.Go-Back-N ARQ is a more efficient use of a connection than Stop-and-wait, since unlike waiting for an acknowledgement for each packet, the connection is still being utilized as packets are being sent.

In other words, during the time that would otherwise be spent waiting, more packets are being sent. However, this method also results in sending frames multiple times – if any frame was lost or damaged, or the ACK acknowledging them was lost or damaged, then that frame and all following frames in the window will be resent.