9
Introduction: Simulation is the imitation of some real thing available, state of affairs, or process. Simulation is used in many contexts, such as simulation of technology for performance optimization, safety engineering , testing , training , education , and video games . There are four basic steps in simulation of communication networks: i) Model the network by specifying important parameters ii) Identify data to be collected iii) Run the simulations and collect statistics iv) Post-simulation: To view and analyze results The Transmission Control Protocol ( TCP ) is one of the core protocols of the Internet Protocol Suite . TCP is one of the two original components of the suite, complementing the Internet Protocol (IP), and therefore the entire suite is commonly referred to as TCP/IP . TCP provides reliable, ordered delivery of a stream of bytes from a program on one computer to another program on another computer. TCP is the protocol that major Internet applications such as the World Wide Web , email , remote administration and file transfer rely on. Other applications, which do not require reliable data stream service, may use the User Datagram Protocol (UDP), which provides a datagram service that emphasizes reduced latency over reliability. TCP is responsible for keeping the unordered segments in the right order. TCP assures a reliable delivery by resending anything that gets lost while traveling the network. TCP also implements a congestion control mechanism. TCP provides the following facilities: i) Stream data transfer: The TCP is able to transfer a continuous stream of octets in each direction between its users by packing some numbers of octets into segments for transmission through the internet system. Applications working at the Application Layer transfer a continuous stream of bytes to the bottom layers. It is the duty of

Lab report data com 1.docx

Embed Size (px)

Citation preview

Introduction:Simulationis the imitation of some real thing available, state of affairs, or process. Simulation is used in many contexts, such as simulation oftechnologyfor performance optimization,safety engineering,testing,training,education, and video games.There are four basic steps in simulation of communication networks:i) Model the network by specifying important parametersii) Identify data to be collectediii) Run the simulations and collect statisticsiv) Post-simulation: To view and analyze resultsTheTransmission Control Protocol(TCP) is one of the coreprotocolsof theInternet Protocol Suite. TCP is one of the two original components of the suite, complementing theInternet Protocol(IP), and therefore the entire suite is commonly referred to asTCP/IP. TCP provides reliable, ordered delivery of a stream of bytes from a program on one computer to another program on another computer. TCP is the protocol that major Internet applications such as theWorld Wide Web,email,remote administrationandfile transferrely on. Other applications, which do not require reliable data stream service, may use theUser Datagram Protocol(UDP), which provides adatagramservice that emphasizes reducedlatencyover reliability. TCP is responsible for keeping the unordered segments in the right order. TCP assures a reliabledeliveryby resending anything that gets lost while traveling the network. TCP also implements a congestion control mechanism.TCP provides the following facilities:i) Stream data transfer: The TCP is able to transfer a continuous stream of octets in each direction between its users by packing some numbers of octets into segments for transmission through the internet system. Applicationsworking at theApplicationLayer transfer a continuousstreamof bytes to the bottom layers. It is the duty of TCP to pack this bytestreamto packets, known as TCP segments, which are passed to theIP layerfor transmission to the destinationdevice. Theapplicationdoes not have to bother to chop the bytestreamdata packets.ii) Reliability:The most important feature of TCP is reliable datadelivery. In order to provide reliability, TCP must recover from data that is damaged, lost, duplicated, or delivered out of order by the Network Layer. TCP assigns a sequence number to each byte transmitted, and expects apositiveacknowledgment (ACK) from the receiving TCP layer. If the ACK is not received within a timeout interval, the data is retransmitted. The receiving TCP uses the sequence numbers to rearrange the segments when they arrive out of order, and to eliminate duplicate segments. A number of mechanisms help provide the reliability TCP guarantees such as checksums, duplicate data detection, retransmission, sequencing and timers. iii) Flow control: Indata communications,flow controlis the process of managing the pacing of data transmission between two nodes to prevent a fast sender from outrunning a slow receiver. It provides a mechanism for the receiver to control the transmission speed, so that the receiving node is not overwhelmed with data from transmitting node. Flow control should be distinguished fromcongestion control, which is used for controlling the flow of data when congestion has actually occurred. TCP provides a means for the receiver to govern the amount of data sent by the sender. This is achieved by returning a Window with every ACK indicating a range of acceptable sequence numbers beyond the last segment successfully received, The window indicates an allowed number of octets that the sender transmit before receiving further permission. The TCP at the receivingdevice, whensendingan ACK back to the sender, also indicates to the TCP at thesendingdevice, the number of bytes it can receive without causing serious problems in its internal buffers.

iv) Multiplexing: To allow for many processes within a single host to use TCP communication facilities simultaneously, the TCP provides a set of addresses or ports within each host. Concatenated with the network and host addresses from the Internet communication layer, this forms a socket (see Figure 1). A pair of sockets uniquely identifies each connection.

v) Logical connections: The reliability and flow control mechanisms described above require that TCPs initializes and maintains certain status information for each data stream. The combination of this status including sockets, sequence numbers, window sizes is called a logical connection. When two processes wish to communicate, Their TCPs must first establish a connection. When their connection is completed, the connection is terminated or closed to free the resources for other users. Since connections must be established between unreliable hosts and over the unreliable internet communication system, a handshake mechanism with clock-based sequence numbers is used to avoid erroneous initialization of connections.

vi) Full Duplex: TCP establishes a full duplex virtual connection between two endpoints. Each endpoint is defined by an IP address and a TCP port number. The operation of TCP is implemented as a finite state machine.

Reliable Transmission and Congestion Control in TCP:Reliable transmission: TCP uses asequence numberto identify each byte of data. The sequence number identifies the order of the bytes sent from each computer so that the data can be reconstructed in order, regardless of any fragmentation, disordering, orpacket lossthat may occur during transmission. For every payload byte transmitted, the sequence number must be incremented. In the first two steps of the 3-way handshake, both computers exchange an initial sequence number (ISN). This number can be arbitrary, and should in fact be unpredictable to defend againstTCP Sequence Prediction Attacks.TCP primarily uses acumulative acknowledgmentscheme, where the receiver sends an acknowledgment signifying that the receiver has received all data preceding the acknowledged sequence number. The sender sets the sequence number field to the sequence number of the first payload byte in the segment's data field, and the receiver sends an acknowledgment specifying the sequence number of the next byte they expect to receive. For example, if a sending computer sends a packet containing four payload bytes with a sequence number field of 100, then the sequence numbers of the four payload bytes are 100, 101, 102 and 103. When this packet arrives at the receiving computer, it would send back an acknowledgment number of 104 since that is the sequence number of the next byte it expects to receive in the next packet.In addition to cumulative acknowledgments, TCP receivers can also sendselective acknowledgmentsto provide further information.If the sender infers that data has been lost in the network, itretransmitsthe data.Congestion controlThe final main aspect of TCP iscongestion control. TCP uses a number of mechanisms to achieve high performance and avoidcongestion collapse, where network performance can fall by several orders of magnitude. These mechanisms control the rate of data entering the network, keeping the data flow below a rate that would trigger collapse. They also yield an approximatelymax-min fairallocation between flows.Acknowledgments for data sent, or lack of acknowledgments, are used by senders to infer network conditions between the TCP sender and receiver. Coupled with timers, TCP senders and receivers can alter the behavior of the flow of data. This is more generally referred to as congestion control and/or network congestion avoidance.Modern implementations of TCP contain four intertwined algorithms:Slow-start,congestion avoidance,fast retransmit, andfast recovery. To support the congestion avoidance algorithm, the sender keeps two state variables: congestion window, cwnd and a threshold ssthresh which is used to indicate the adjustment of the congestion window. So the algorithm adjusts the window to safe operating point then additive increase takes over and slowly increases the window size to probe for more bandwidth. This enables TCP to deliver its data reliably and efficiently even in a congested environment.ConclusionsTCP is a fairly complex protocol that handles the brunt of functionality in a packet switched network such as the Internet. Supporting the reliable delivery of data on a packet switched network is not a trivial task. This document only scratches the surface of the TCP internals, but hopefully provided the reader with an appreciation and starting point for further interest in TCP. Even after almost 20 years of standardization, the amount of work that goes into supporting and designing reliable packet switched networks has not slowed. It is an area of great activity and there are many problems to be solved. As the Internet continues to grow, our reliance on TCP will become increasingly important. It is therefore imperative for network engineers, designers and researchers to be as well versed in the technology as possible.

NoTimeTypeSequence NoSent fromReceived at

10DATA00

20.2016DATA01

30.2016ACK01

40.4032ACK00

50.4032DATA10

60.6448DATA11

70.6448ACK11

80.8464ACK10

90.8464DATA20

101.088DATA21

111.088ACK21

121.2896ACK20

131.2896DATA30

141.5312DATA31

151.5312ACK31

161.7328ACK30

171.7328DATA40

181.9744DATA41

191.9744ACK41

202.176ACK40

NoTimeTypeSequence NoRemarks

12.176DATA5Sent from node 0

22.176DATA5Dropped on link 0 to 1

33.176DATA5Sent from node 0

43.4176DATA5Received at node 1

53.4176ACK5Sent from node 1

63.6192ACK5Received at node 0

73.6192DATA6Sent from node 0

83.8608DATA6Received at node 1

93.8608ACK6Sent from node 1

104.0624ACK6Received at node 0

114.0624DATA7Sent from node 0

124.304DATA7Received at node 1

134.304ACK7Sent from node 1

144.5056ACK7Received at node 0

154.5056DATA8Sent from node 0

164.7472DATA8Received at node 1

174.7472ACK8Sent from node 1

184.9488ACK8Received at node 0

194.9488DATA9Sent from node 0

204.9488DATA9Dropped on link 0 to 1

215.9488DATA9Sent from node 0

226.1904DATA9Received at node 1

236.1904ACK9Sent from node 1

246.392ACK9Received at node 0

SizeBytes Transmitted

4538.0

5671.0

6804.0

7936.0

81068.0

SizeBytes Transmitted

110.0 Kbytes

220.0 Kbytes

329.0 Kbytes

438.0 Kbytes

546.0 Kbytes

654.0 Kbytes

762.0 Kbytes

870.0 Kbytes

No of pairsDurationBytes TransmittedDelay

26 s350 Kbytes0.2498 s

46 s175 Kbytes0.3397 s

66 s105.166 Kbytes0.3561 s

86 s83.625 Kbytes0.3796 s

106 s67.599 Kbytes0.3624 s

126 s56.332 Kbytes0.3674 s

146 s48.284 Kbytes0.3685 s

166 s42.625 Kbytes0.3950 s