1 TCP. 2 Contents TCP TCP connection TCP flow control TCP congestion control TCP timer UDP

  • View
    241

  • Download
    5

Embed Size (px)

Text of 1 TCP. 2 Contents TCP TCP connection TCP flow control TCP congestion control TCP timer UDP

  • Slide 1
  • 1 TCP
  • Slide 2
  • 2 Contents TCP TCP connection TCP flow control TCP congestion control TCP timer UDP
  • Slide 3
  • 3 DLP Host Transport layer protocol Transport Layer End-to-end data transfer (cf) DLP(data link protocol) data transfer between adjacent nodes DLP
  • Slide 4
  • 4 Transport Layer services Addressing the application process and delivering data between processes What else should the transport layer do for application? network access 1 IP Transport network Access 2 IP transport network access1 access2 IP subnet 1 end-to-end subnet 2 AP1AP2AP3AP1AP2AP3
  • Slide 5
  • 5 What the transport layer should do in the Internet(1) IP provides unreliable services to the upper layers. no error control IP does merely the header checksum, but do not send ACKs nor retransmit. no flow control/no congestion control IP doesnt have any function to control the transmission rate depending on the states of receivers or networks. duplicate packet discovery When packets are not delivered within the predefined time limit to the receiver because of network congestion or taking detour, even though those packets are not lost on the way, the sender retransmits the same packets. Also, the ACK packets are not delivered to the sender within the predefined time limit, the sender times out and retransmits the same packets. The IP of receiver cannot detect those duplicate packets and delivers the packets to the upper layers. out-of-order packet delivery Because IP use the datagram mode, packets can take different paths, consequently they might arrive out of order.
  • Slide 6
  • 6 What the transport layer should do in the Internet(2) The application data that are delivered by IP might be lost due to error or congestion, or arrive at the destination out of order, or be duplicated at the destination. Thus, the transport layer protocol in the Internet should provide the reliable services to the application layers if the application requires reliable service. Otherwise all dirty work should be done by application itself. There are two transport protocols in the Internet. TCP provide reliable services. UDP - simple, streamlined delivery services to the application layers which do not need reliable service.
  • Slide 7
  • 7 Internet transport layer protocols TCP(Transmission Control Protocol) provide reliable services to the application layers. Multiplexing (addressing the application services) error control (error detection and retransmission) flow control congestion control Guarantee no out-of-sequence of the packet order UDP(User Datagram Protocol) Provide unreliable services UDP does very simple function compared to TCP. Multiplexing (addressing the application services) Error detection (optional)
  • Slide 8
  • 8 TCP service characteristics End-to-end reliable service guarantee the reliable data transfer between application processes No error, no loss, no out-of-sequence connection-oriented service Consists of three steps: connection setup, data transfer, connection release full duplex transmission TCP connection setup enables two-way connections. stream-oriented transmission TCP views messages from application processes as continuous byte stream, not as separate packets. Graceful connection release When the connection terminates, TCP releases the connection after data transfer is completed.
  • Slide 9
  • 9 How to provide reliable services(1) Transmission unit is segment. The data sent to TCP from application processes are fragmented to have the size proper for transmission. Each fragmented data is called a segment. So the segment is the transmission unit when TCP sends application process data. On the contrary, UDP does not fragment the application data, instead send the data as it was given from application processes. Management of the segment sequence Each segment is given a sequence number (viewed as byte streams), so receiver TCP can recognize any loss of segments and the out-of-sequence of arriving segments. ACK transmission When TCP receives correct segments, it always replies with ACK segment. For enhancing performance, it uses the accumulative ACK. Timer management When TCP sends segments, it starts a timer. When the ACK for the segments sent does not arrive until the timer times out, it resends the same segment.
  • Slide 10
  • 10 How to provide reliable services(2) Error control (checksum) TCP checks any error on the segments it received using the checksum field in the header. If it finds any error, it discards the segment. Also using the sequence number on the segment, it checks any loss of segments or out-of-sequence of the segments. Order control The receiver stores the packets it receives in the buffer, and after keeping the order of segments, it delivers them to application processes. Detection and discard of duplicate segments When the same segments arrives, the receiver discard the segment.
  • Slide 11
  • 11 How to provide reliable services(3) Clear connection management Clear connection setup using 3 way handshake Also, clear connection release using 3 way handshake When one end station happens to reboot, the station will setup another TCP connection in addition to the current TCP connection. In this case, TCP can distinguish the segments of the previous connection and the newly established connection. Flow control TCP uses a buffer, and notifies the other TCP on the connection of the available space in the buffer for receiving. So the other TCP can send only the amount of segments and stop. Congestion control TCP controls transmission rate depending on congestion state in the network.
  • Slide 12
  • 12 TCP headerTCP data IP datagram TCP segment 20 octets TCP Header IP header
  • Slide 13
  • 13 TCP Header Options (if any) Data (if any) 16-bit source port number16-bit destination port number 32-bit sequence number 32-bit acknowledgement number 4bit hdr length Reserved (6 bits) URGURG ACKACK PSHPSH RSTRST SYNSYN FINFIN 16-bit window size 16-bit TCP checksum16-bit urgent pointer TCP header Padding(if any)
  • Slide 14
  • 14 Bit position Name function 11 URG urgent pointer field valid 12 ACK acknowledgment field valid 13 PSH deliver data on receipt of this segment 14 RST reset the sequence/acknowledgment numbers 15 SYN synchronization 16 FIN end of byte stream from sender TCP Segment Format(code Bits)
  • Slide 15
  • 15 Port number: addressing application A connection is identified uniquely by 5 elements. (sender IP address, receiver IP address, protocol number, sender application process port number, receiver application process port number) The combination of an IP address and a port number is sometimes called socket. Network access IP Network access IP subnet TCP connection AP Network access IP Port protocol H/W addr IP addr TCPUDPTCPUDP AP
  • Slide 16
  • 16 Connection Identification addresses IP address identifies a specific host in the Internet. has 1:1 mapping to the subnet physical address that the host is connected to. Protocol number identifies an upper layer protocol to which IP in the destination host should send data. Port number identifies an application process to which the receiver IP should deliver data. well-known port numbers the port numbers that were already decided by ICANN for their uses such as FTP server is 21, Telnet server is TCP 23, etc. Ephemeral number port numbers that is assigned temporarily for application processes established presently.
  • Slide 17
  • 17 Well Known TCP Ports(/etc/services) KeywordUNIX keywordDescription 0Reserved 1TCPMUX-TCP Multiplexor 5RJE-Remote Job Entry 7ECHOechoEcho 9DISCARDdiscardDiscard 11USERSsystatActive Users 13DAYTIMEdaytimeDaytime 15-netstatNetwork status program 17QUOTEqotdQuote of the day 19CHARGENchargenCharacter Generator 20FTP-DATAftp-dataFile Transfer Protocol 21FTPftpFile Transfer Protocol 23TELNETtelnetTerminal Connection 25SMTPsmtpSimple Mail Transport Protocol 37TIMEtimeTime 42NAMESERVERnameHost Name Server 43NICNAMEwhoisWho Is 53DOMAINnameserverDomain Name Server 77-rjeany private RJE service 79FINGERfingerFinger 93DCP-Device Control Protocol 95SUPDUPsupdupSUPDUP Protocol
  • Slide 18
  • 18 Sequence Number Segment number identifies the byte in the stream of data from the sending TCP to the receiving TCP, It represents the first byte of data in the segment. The unit is not segments, but bytes.. The size is 2 32 large enough to detect duplicate segments. TCP userTCP [seq=300, data] [seq=500, data] [seq=650, data] SEND (200 byte data) SEND (100 byte data) SEND (150 byte data)
  • Slide 19
  • 19 Acknowledge Number Accumulative ACK By convention, the ACK number is the byte number of the segment that the receiver expects to receive next time. Sender TCPReceiver TCP [seq=1000, 100 byte data] [seq=1100, 200 byte data] [seq=1300, 100 byte data] [ACK=1400]
  • Slide 20
  • 20 Duplicate segments in the same connection Transport Entity A Transport Entity B SN1 SN2 SN3 SN5 SN4 SN6 SN7 SN0 ACK3 ACK4 ACK5 ACK6 ACK0 ACK7 A times out and retransmits SN0 A times out and retransmits SN1 Obsolete SN0 arrives assumption: - seq. number: mod 8 - use the accumulative ACK SN0 Solution: sequence number space should be large enough New SN0 arrives
  • Slide 21
  • 21 SN 2 SYN SN 0 SN 1 SN 2 Obsolete segment SN = 2 is accepted; valid segment SN = 2 is discarded as duplicate Duplicate segments in different connections(1) Transport entity A Transport entity B New connect