1 / 111

Understanding TCP Communication and Services

Explore the process-to-process communication using TCP, including port numbers, error control mechanisms, connection-oriented features, and TCP services such as stream delivery and reliability. Learn about TCP features like byte numbering and full-duplex service.

ghardman
Download Presentation

Understanding TCP Communication and Services

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Chapter 12 Transmission Control Protocol

  2. Introduction • Position of TCP

  3. Introduction (cont’d) • Responsibilities of Transport Layer • to create a process-to-process communication • using port numbers in case of TCP • to provide a flow-and-error control mechanism at the transport level • TCP uses sliding window protocol to achieve error control. • TCP uses the acknowledgment packet, time-out, and retransmission to achieve error control. • to provide a connection mechanism for the application program • sending streams of data to the transport layer by application program • making a connection with the receiver, chopping the stream into transportable units, numbering them and sending them one by one

  4. Introduction (cont’d) • At the receiving end, waiting until all the different units belonging to same application program have received, checking, passing those that are error free and delivering them to the receiving application program as a stream. • After the entire stream has been sent, the transport layer should close the connection. • TCP is called a connection-oriented, reliable transport protocol • adding connection-oriented and reliability features to the services of IP

  5. 12.1 Process-to-Process Communication • Host-to-host communication and process-to-process communication

  6. Process-to-Process Communication (cont’d) • Port Addresses (Numbers) • process-to-process communication that achieved through the client/server paradigm • to define the client and server programs, we need second identifiers called port numbers. • integers between 0 and 65,535 • The client program running on the local computer defines itself with a port number, chosen randomly by the TCP software running on the local host • using a ephemeral port number • But, the server program on the remote computer must also define itself with a port number • using a well-known port number

  7. Process-to-Process Communication (cont’d) • Explanation of port numbers using TENET application

  8. Process-to-Process Communication (cont’d) • Well-known ports used by TCP

  9. Process-to-Process Communication (cont’d) • Socket Addresses • To make a connection, • needs 2 identifier : IP address + Port number  Socket address • a pair of socket address • Client socket address • Server socket address

  10. 12.2 TCP Services • Stream Delivery Service • TCP is a stream-oriented protocol • TCP creates an environment in which the two processes seem to be connected by an imaginary “tube” that carries their data across the Internet.

  11. TCP Services (cont’d) • Sending and Receiving Buffers • Because the sending and receiving processes may not produce and consume data at the same speed, TCP needs buffers for storage. • One way to implement is to use a circular array Not acknowledged

  12. TCP Services (cont’d) • TCP Segments

  13. TCP Services (cont’d) • Stream Data Service (stream transport layer service) • The sending TCP 1) accepts a stream of characters from sending application program 2) creates packets called segments, of appropriate size extracted from the stream 3) sends segments across the network • The receiving TCP 1) receives segments, extracts data from segments 2) orders segments if they have arrived out of order 3) delivers segments as a stream of characters to the receiving application program

  14. TCP Services (cont’d) • For stream delivery, • the sending and receiving TCPs use buffers • the sending TCP uses sending buffer to store the data coming from the sending application program. • the sending application program writes data to the buffer of the sending TCP • the receiving TCP receives the segments and stores them in a receiving buffer • the receiving application program uses the read operation to read the data from the receiving buffer. • Since the rate of reading can be slower than the rate of receiving, the data is kept in the buffer until the receiving application reads it completely.

  15. TCP Services (cont’d) • Full-Duplex Service • TCP offers full-duplex service • After two application programs are connected to each other, they can both send and receive data. • Piggybacking • When a packet is going from A to B, it can also carry an acknowledgment of the packets received from B

  16. TCP Services (cont’d) • Connection-Oriented Services • A’s TCP informs B’s TCP and gets approval from B’s TCP • A’s TCP and B’s TCP exchange data in both directions • After both processes have no data left to send and the buffers are empty, two TCPs destroy their buffers • Reliable Service • TCP uses the acknowledgment mechanism to check the safe and sound arrival of data

  17. 12.3 TCP Features • Byte numbers • All data bytes being transferred in each connection are numbered by TCP. • The numbering starts with a randomly generated number. • Number range for first byte : 0 ~ 2 32 -1 • If random number is 1,057 and total number 6,000bytes, the bytes are numbered from 1,057 to 7,056 • Byte numbering is used for flow and error control.

  18. Numbering Bytes (cont’d) • Sequence number • After the bytes have been numbered, TCP assigns a sequence number to each segment that is being sent. • Segment number for each segment is number of the first byte carried in that segment.

  19. Numbering Bytes (cont’d) • Example 2 • Imagine a TCP connection is transferring a file of 5000 bytes. The first byte is numbered 10001. What are the sequence numbers for each segment if data is sent in five segments with the each segment carrying 1,000 bytes?

  20. Numbering Bytes (cont’d) Solution The following shows the sequence number for each segment: Segment 1  10,001 (10,001 to 11,001) Segment 2  11,001 (11,001 to 12,001) Segment 3  12,001 (12,001 to 13,001) Segment 4  13,001 (13,001 to 14,001) Segment 5  14,001 (14,001 to 15,001)

  21. Numbering Bytes (cont’d) • Acknowledgment Number • The value of the acknowledgment field in a segment defines the number of the next byte a party expects to receives. The acknowledgment number is cumulative.

  22. 12.3 Segment • A packet in TCP is called segment

  23. Segment (cont’d) • Source port address • defining the port number of application program in the host that is sending the segment • Destination port address • defining the port number of application program in the host that is receiving the segment • Sequence number • defining the number assigned to the first byte of data contained in this segment • during the connection establishment, each party uses a random number generator to create an initial sequence number (ISN)

  24. Segment (cont’d) • Acknowledgment number • If the source of the segment has successfully received byte number x from the other party, it defines x+1 as the acknowledgment number • Header length • Indicating the number of 4-byte words in the TCP header • the value between 5 and 15 (20 and 60 bytes) • Reserved • For future use

  25. Segment (cont’d) • Control • Enabling flow control, connection establishment and termination, and mode of data transfer in TCP

  26. Segment (cont’d) • Description of flags in the control field

  27. Segment (cont’d) • Window size • defining the size of the window, in bytes, that the other party must maintain. • maximum size of window : 65,535 bytes • Checksum : picture in next page • Urgent pointer • used when the segment contains urgent data • defining the number that must be added to the sequence number to obtain the number of the last urgent byte in the data section of the segment • Options : 40 bytes

  28. Segment (cont’d)

  29. Segment (cont’d) • A TCP segments is encapsulated in an IP datagram

  30. 12.4 TCP Connection • The server program tells its TCP to make a passive open • The Client program issues a request for an active open. +

  31. TCP Connection – three-way handshaking • A SYN segment cannot carry data, but it consumes one sequence number. • A SYN + ACK segment cannot carry data, but does consume one sequence number. • An ACK segment, if carrying no data, consumes no sequence number.

  32. TCP Connection (Cont’d) • Data transfer

  33. TCP Connection (Cont’d) • Urgent data • To send urgent data • Use of URG bit set by sending TCP • Receiving TCP extracts the urgent data from the segment using urgent pointer

  34. TCP Connection (Cont’d) • Connection Termination • The FIN segment consumes one sequence number if it does not carry data. • The FIN + ACK segment consumes one sequence number if it does not carry data. +

  35. TCP Connection (Cont’d) • Half-close - + + +

  36. 12.5 State Transition Diagram • To keep track of all the different events happening during connection establishment, connection termination, and data transfer, the TCP software is implemented as a finite state machine.

  37. State Transition Diagram (cont’d)

  38. Server Client Special Input / Output State Transition Diagram (Cont’d) • A state transition diagram or RST/- Simultaneous Close MSL : Maximum Segment Lifetime (30 sec ~ 1 min) Three-way Handshake (2MSL) Now connection is closed in one direction.

  39. Connection Establishment and Termination

  40. Connection Termination Using Three-way Handshake

  41. Simultaneous Open

  42. Simultaneous Close

  43. Denying a Connection

  44. Aborting a Connection

  45. 12.6 Flow Control • Defining the amount of data that a source can send before receiving an acknowledgement from the destination. • Sliding window • For flow control, TCP uses a sliding window protocol • The window covers a portion of the buffer that a host can send before worrying about an acknowledgment from other host • A sliding window is used to make transmission more efficient as well as to control the flow of data so that the destination does not become overwhelmed with data. • TCP sliding windows are byte oriented.

  46. Sliding Window Protocol

  47. Sliding Window Protocol • an Example

  48. Flow Control (cont’d) • In TCP, the sender window size is totally controlled by the receiver window value. However, the actual window size can be smaller if there is congestion in the network. • Some Points about TCP’s Sliding Windows: • The size of the window is the lesser of rwnd and cwnd • The source does not have to send a full window’s worth of data. • The window can be opened or closed by the receiver, but should not be shrunk. • The destination can send an acknowledgment at any time as long as it does not result in a shrinking window. • The receiver can temporarily shut down the window; the sender, however, can always send a segment of one byte after the window is shut down. • To prevent deadlock by proving

  49. 12.7 Error Control • Including mechanisms for detecting corrupted segments, lost segments, out-of-order segments, and duplicated segments. • Also, including a mechanism for correcting errors after they are detected. • Error Detection and Correction • Checksum • Acknowledgment : TCP does not use negative acknowledgment • Time-out

  50. Normal Operation

More Related