Sei sulla pagina 1di 6

What is a TCP Window?

A TCP window is the amount of unacknowledged data a sender can send on a particular connection before it gets an acknowledgment back from the receiver, that it has received some of the data.

TCP Sliding Window


The working of the TCP sliding window mechanism can be explained as below. The sending device can send all packets within the TCP window size (as specified in the TCP header) without receiving an ACK, and should start a timeout timer for each of them. The receiving device should acknowledge each packet it received, indicating the sequence number of the last well-received packet. After receiving the ACK from the receiving device, the sending device slides the window to right side.

In this case, the sending device can send up to 5 TCP Segments without receiving an acknowledgement from the receiving device. After receiving the acknowledgement for Segment 1 from the receiving device, the sending device can slide its window one TCP Segment to the right side and the sending device can transmit segment 6 also. If any TCP Segment lost while its journey to the destination, the receiving device cannot acknowledge the sender. Consider while transmission, all other Segments reached the destination except Segment 3. The receiving device can acknowledge up to Segment 2. At the sending device, a timeout will occur and it will retransmit the lost Segment 3. Now the receiving device has received all the Segments, since only Segment 3 was lost. Now the receiving device will send the ACK for Segment 5, because it has received all the Segments to Segment 5. Acknowledgement for Segment 5 ensures the sender the receiver has succesfully received all the Segments up to 5.
TCP uses a byte level numbering system for communication. If the sequence number for a TCP segment at

any instance was 5000 and the Segment carry 500 bytes, the sequence number for the next Segment will be 5000+500+1. That means TCP segment only carries the sequence number of the first byte in the segment. The Window size is expressed in number of bytes and is determined by the receiving device when the connection is established and can vary later. You might have noticed when transferring big files from one Windows machine to another, initially the time remaining calculation will show a large value and will come down later.

We have four catagories in above example. 1) Bytes already sent and acknowledged (upto Byte 20). 2) Bytes sent but not acknowledged (Bytes 21-24). 3) Bytes the receiver is ready to accept (Bytes 25-28). 4) Bytes the receiver is not ready to accept (Byte 29 onwards). The Send Window is the sum of Bytes sent but not acknowledged and Bytes the receiver is ready to accept (Usable Window).

Transmission Control Protocol (TCP) Connection Termination


When the data transmission is complete and the device want to terminate the connection, the device initiating the termination, places a TCP segment with the FIN flag set to one. The purpose of FIN bit is to enable TCP to gracefully terminate an established session. The application then enters in a state called the FIN-WAIT state. When at FIN-WAIT state, Device A continues to receive segments from Device B and processes the segments already in the queue, but no additional data is accepted from the application.

TCP Connection Termination In the example shown above, assume Device A has completed its transmission and indicates this by sending a segment to Device B with the FIN bit set to 1. Device B will acknowledge the segment with an ACK. At this point in time, Device B will no longer accept data from Device A. Device B can continue to accept data from its application to transmit to Device A. If Device B does not have any more data to transmit, it will also terminate the connection by transmitting a segment to Device A with the FIN bit set to 1. Device A will then ACK that segment and terminates the connection.

User Datagram Protocol (UDP)


3

In this lesson, you will learn more about User Datagram Protocol (UDP), User Datagram Protocol (UDP) header and header fields. User Datagram Protocol (UDP) is a protocol at Transport Layer, which is not reliable when compared with Transmission Control Protocol (TCP). User Datagram Protocol (UDP) is also called as a connection less protocol. UDP is much simpler than TCP, and it doesn't perform any of the complex functions of TCP we discuss before. UDP is basically an application interface to IP. UDP provides no reliability, flow-control, or error recovery to IP. UDP only serves as a multiplexer/demultiplexer using port numbers. Following are the important characteristics of UDP. 1) User Datagram Protocol (UDP) is a connectionless protocol, which means UDP is not a reliable protocol when compared with Transmission Control Protocol (TCP). 2) User Datagram Protocol (UDP) is capable of performing fundamental error checking. The UDP header includes a checksum field that the destination device can use to check the integrity of the data. 3) User Datagram Protocol (UDP) does not provide sequencing of data. Therefore, the data may arrive at the destination device in a different order from which it was sent. This may happen in large networks, such as the Internet, where the Datagrams might take different paths to the destination and experience delays in different routers. In LAN's sequencing is not going to create problems. Applications that require sequencing must code their own sequencing mechanism as part of the application.

User Datagram Protocol (UDP) Header

Source Port Number: The first 16 bits of the UDP header contain the port number of the application sending the data. Destination Port Number: The next 16 bits contain the port number of the application that receives this data. Length: The next 16 bits identify how long the datagram is in bits. Checksum: The last 16 bits of the UDP header are reserved for the checksum value. Checksum is used as an error-detection mechanism. The source machine runs a mathematical algorithm on the datagram. The destination, or recipient, machine runs the same mathematical algorithm on the datagram. If the both values match we can assume that the datagram wasn't damaged while its journey. The checksum field includes a 12-byte 'pseudo header' that includes the source and destination IP addresses, the 8-bit reserved field containing 0, the 8-bit protocol ID and the 16-bit UDP length field. The pseudo header is useful to check that the IP datagram arrived at the correct station. Important protocols which use UDP as the Transport Layer protocol are Trivial File Transfer Protocol (TFTP), Domain Name System (DNS), Remote Procedure Call (RPC) used by the Network File System (NFS), Simple Network Management Protocol (SNMP) and Lightweight Directory Access Protocol (LDAP). For a complete list of Well Known port numbers, visit IANA Port Number Assignment web page. Differences between TCP and UDP 4 Transmission Control Protocol (TCP) and User Datagram Protocol (UDP) are the major protocols operating at Transport Layer. Transmission Control Protocol (TCP) and User Datagram Protocol (UDP) operate very differently and you can choose Transmission Control Protocol (TCP) or User Datagram Protocol (UDP) depending on your requirement. TCP stands for Transmission Control Protocol and it guarantees delivery of data packets. This protocol provides extensive error checking mechanisms such as flow control and acknowledgment of data. Transmission Control Protocol (TCP) is a connection oriented protocol. Before transmitting data, a connection must be established between the devices participating in data transmission. If your Application require guaranteed delivery of data, then you must choose TCP as the Transport layer protocol. UDP stands for User Datagram protocol and it operates in Datagram mode. The main difference you should

notice here is User Datagram Protocol (UDP) is a connection-less protocol. User Datagram protocol (UDP) has only the basic error checking mechanism using checksums. Difference between Transmission Control Protocol (TCP) and User Datagram Protocol (UDP) Transmission Control Protocol (TCP) 1) Transmission Control Protocol (TCP) is a connection oriented protocol, which means the devices should open a connection before transmitting data and should close the connection gracefully after transmitting the data. 2) Transmission Control Protocol (TCP) assure reliable delivery of data to the destination. 3) Transmission Control Protocol (TCP) protocol provides extensive error checking mechanisms such as flow control and acknowledgment of data. 4) Sequencing of data is a feature of Transmission Control Protocol (TCP). 5) Delivery of data is guaranteed if you are using Transmission Control Protocol (TCP). 6) Transmission Control Protocol (TCP) is comparatively slow because of these extensive error checking mechanisms 7) Multiplexing and Demultiplexing is possible in Transmission Control Protocol (TCP) using TCP port numbers. 8) Retransmission of lost packets is possible in Transmission Control Protocol (TCP).

User Datagram Protocol (UDP) 1) User Datagram Protocol (UDP) is Datagram oriented protocol with no overhead for opening, maintaining, and closing a connection. 2) User Datagram Protocol (UDP) is efficient for broadcast/multicast transmission. 3) User Datagram protocol (UDP) has only the basic error checking mechanism using checksums. 4) There is no sequencing of data in User Datagram protocol (UDP) . 5) The delivery of data cannot be guaranteed in User Datagram protocol (UDP) . 6) User Datagram protocol (UDP) is faster, simpler and more efficient than TCP. However, User Datagram protocol (UDP) it is less robust then TCP 7) Multiplexing and Demultiplexing is possible in User Datagram Protcol (UDP) using UDP port numbers. 8) There is no retransmission of lost packets in User Datagram Protcol (UDP). Application Layer 4 The lower layers of TCP/IP protocol suit are primarily concerned with formatting, encapsulating and transmitting data across the network. These layers are closely associated with the underlying network hardware and network infrastructure devices. The topmost layer, Application Layer of TCP/IP suit is concerned mainly with human interaction and the implementation of software applications and related protocols. TCP/IP protocol suit is included with a large number of applications and application protocols. Using these applications and application protocols, data can be moved between hosts, and remote users can communicate. Following are a partial list of applications and application protocols included with TCP/IP protocol suit and operate in the Application Layer.

y Hypertext Transfer Protocol (HTTP) y Simple Mail Transfer Protocol (SMTP) y y


Dynamic Host Configuration Protocol (DHCP) y Domain Name System (DNS) Simple Network Management Protocol (SNMP) y File Transfer Protocol (FTP) Trivial File Transfer Protocol (TFTP)

Potrebbero piacerti anche