Transmission Control Protocol - Wikipedia, the free encyclopedia. The Transmission Control Protocol (TCP) is one of the main protocols of the Internet protocol suite. It originated in the initial network implementation in which it complemented the Internet Protocol (IP). Therefore, the entire suite is commonly referred to as TCP/IP. TCP provides reliable, ordered, and error- checked delivery of a stream of octets between applications running on hosts communicating by an IP network. Major Internet applications such as the World Wide Web, email, remote administration and file transfer rely on TCP. Applications that do not require reliable data stream service may use the User Datagram Protocol (UDP), which provides a connectionlessdatagram service that emphasizes reduced latency over reliability. Historical origin. A central control component of this model was the Transmission Control Program that incorporated both connection- oriented links and datagram services between hosts. The monolithic Transmission Control Program was later divided into a modular architecture consisting of the Transmission Control Protocol at the connection- oriented layer and the Internet Protocol at the internetworking (datagram) layer. The model became known informally as TCP/IP, although formally it was henceforth termed the Internet Protocol Suite. Network function. It provides host- to- host connectivity at the Transport Layer of the Internet model. An application does not need to know the particular mechanisms for sending data via a link to another host, such as the required packet fragmentation on the transmission medium. At the transport layer, the protocol handles all . TCP detects these problems, requests retransmission of lost data, rearranges out- of- order data, and even helps minimize network congestion to reduce the occurrence of the other problems. If the data still remains undelivered, its source is notified of this failure. Once the TCP receiver has reassembled the sequence of octets originally transmitted, it passes them to the receiving application. Thus, TCP abstracts the application's communication from the underlying networking details. TCP is used extensively by many applications available by internet, including the World Wide Web (WWW), E- mail, File Transfer Protocol, Secure Shell, peer- to- peerfile sharing, and many streaming media applications. TCP is optimized for accurate delivery rather than timely delivery, and therefore, TCP sometimes incurs relatively long delays (on the order of seconds) while waiting for out- of- order messages or retransmissions of lost messages. It is not particularly suitable for real- time applications such as Voice over IP. For such applications, protocols like the Real- time Transport Protocol (RTP) operating by means of the User Datagram Protocol (UDP) are usually recommended instead.
Since packet transfer by many networks is not reliable, a technique known as positive acknowledgment with retransmission is used to guarantee reliability of packet transfers. This fundamental technique requires the receiver to respond with an acknowledgment message as it receives the data. The sender keeps a record of each packet it sends. The sender also maintains a timer from when the packet was sent, and retransmits a packet if the timer expires before the message has been acknowledged. The timer is needed in case a packet gets lost or corrupted. For example, when an HTML file is sent from a web server, the TCP software layer of that server divides the sequence of octets of the file into segments and forwards them individually to the IP software layer (Internet Layer). The Internet Layer encapsulates each TCP segment into an IP packet by adding a header that includes (among other data) the destination IP address. When the client program on the destination computer receives them, the TCP layer (Transport Layer) reassembles the individual segments, and ensures they are correctly ordered and error free as it streams them to an application. TCP segment structure. The TCP segment is then encapsulated into an Internet Protocol (IP) datagram, and exchanged with peers. The TCP packages the data from these buffers into segments and calls on the internet module . The TCP header contains 1. Below is the example source code from 'TCP/IP Sockets in Java TM: Practical Guide for Programmers' by Kenneth L. Calvert and Michael J. This book can be ordered at your favorite local bookstore or online. SocketTest is a free, small socket tester. It can create both TCP and UDP client and server. A java tool for socket testing. It can create both TCP and UDP client or server. Java, MTS, TCP/IP, IP, Socket, Mobile Trading System, Socket Program, IP Program, IP. Options, pink background in table). The data section follows the header. Its contents are the payload data carried for the application. The length of the data section is not specified in the TCP segment header. It can be calculated by subtracting the combined length of the TCP header and the encapsulating IP header from the total IP datagram length (specified in the IP header). TCP Header. Offsets. Octet. 01. 23. Octet. Bit 0 1 2 3 4 5 6 7 8 9. Source port. Destination port. Sequence number. 86. Acknowledgment number (if ACK set)1. Data offset. Reserved. NSCWRECEURGACKPSHRSTSYNFINWindow Size. Checksum. Urgent pointer (if URG set)2. Options (if data offset > 5. Padded at the end with . The sequence number of the actual first data byte and the acknowledged number in the corresponding ACK are then this sequence number plus 1. If the SYN flag is clear (0), then this is the accumulated sequence number of the first data byte of this segment for the current session. Acknowledgment number (3. ACK flag is set then the value of this field is the next sequence number that the receiver is expecting. This acknowledges receipt of all prior bytes (if any). The first ACK sent by each end acknowledges the other end's initial sequence number itself, but no data. Data offset (4 bits)specifies the size of the TCP header in 3. The minimum size header is 5 words and the maximum is 1. This field gets its name from the fact that it is also the offset from the start of the TCP segment to the actual data. Reserved (3 bits)for future use and should be set to zero. Flags (9 bits) (aka Control bits)contains 9 1- bit flags. NS (1 bit) . It indicates: If the SYN flag is set (1), that the TCP peer is ECN capable. If the SYN flag is clear (0), that a packet with Congestion Experienced flag set (ECN=1. IP header received during normal transmission (added to header by RFC 3. This serves as an indication of network congestion (or impending congestion) to the TCP sender. URG (1 bit) . All packets after the initial SYN packet sent by the client should have this flag set. PSH (1 bit) . Asks to push the buffered data to the receiving application. RST (1 bit) . Only the first packet sent from each end should have this flag set. Some other flags and fields change meaning based on this flag, and some are only valid for when it is set, and others when it is clear. FIN (1 bit) . Options have up to three fields: Option- Kind (1 byte), Option- Length (1 byte), Option- Data (variable). The Option- Kind field indicates the type of option, and is the only field that is not optional. Depending on what kind of option we are dealing with, the next two fields may be set: the Option- Length field indicates the total length of the option, and the Option- Data field contains the value of the option, if applicable. For example, an Option- Kind byte of 0x. No- Op option used only for padding, and does not have an Option- Length or Option- Data byte following it. An Option- Kind byte of 0 is the End Of Options option, and is also only one byte. An Option- Kind byte of 0x. Maximum Segment Size option, and will be followed by a byte specifying the length of the MSS field (should be 0x. Note that this length is the total length of the given options field, including Option- Kind and Option- Length bytes. So while the MSS value is typically expressed in two bytes, the length of the field will be 4 bytes (+2 bytes of kind and length). In short, an MSS option field with a value of 0x. B4 will show up as (0x. B4) in the TCP options section. Some options may only be sent when SYN is set; they are indicated below as . Option- Kind and standard lengths given as (Option- Kind,Option- Length). The padding is composed of zeros. See TCP EFSM diagram for a more detailed state diagram including the states inside the ESTABLISHED state. TCP protocol operations may be divided into three phases. Connections must be properly established in a multi- step handshake process (connection establishment) before entering the data transfer phase. After data transmission is completed, the connection termination closes established virtual circuits and releases all allocated resources. A TCP connection is managed by an operating system through a programming interface that represents the local end- point for communications, the Internet socket. During the lifetime of a TCP connection the local end- point undergoes a series of state changes. The normal state for the data transfer phase of the connection. FIN- WAIT- 1 (both server and client) represents waiting for a connection termination request from the remote TCP, or an acknowledgment of the connection termination request previously sent. FIN- WAIT- 2 (both server and client) represents waiting for a connection termination request from the remote TCP. CLOSE- WAIT (both server and client) represents waiting for a connection termination request from the local user. CLOSING (both server and client) represents waiting for a connection termination request acknowledgment from the remote TCP. LAST- ACK (both server and client) represents waiting for an acknowledgment of the connection termination request previously sent to the remote TCP (which includes an acknowledgment of its connection termination request). TIME- WAIT (either server or client) represents waiting for enough time to pass to be sure the remote TCP received the acknowledgment of its connection termination request. Before a client attempts to connect with a server, the server must first bind to and listen at a port to open it up for connections: this is called a passive open. Once the passive open is established, a client may initiate an active open. To establish a connection, the three- way (or 3- step) handshake occurs: SYN: The active open is performed by the client sending a SYN to the server.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
January 2017
Categories |