1 / 36

Transport Protocols - TCP & UDP

Transport Protocols - TCP & UDP. Transport Protocols. The transport protocol provides an end-to-end data transfer service that shields upper-layer protocols from the details of the intervening network. Two types of transport service connection oriented, e.g. TCP

Download Presentation

Transport Protocols - TCP & UDP

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. Transport Protocols - TCP & UDP

  2. Transport Protocols • The transport protocol provides an end-to-end data transfer service that shields upper-layer protocols from the details of the intervening network. • Two types of transport service • connection oriented, e.g. TCP • connectionless (datagram), e.g. UDP

  3. TCP • Transmission Control Protocol • Connection-oriented • Guarantees reliable and in-order delivery of data • Allow multiple concurrent TCP applications in the same host. • Error detection, Error Correction, Flow Control

  4. TCP Header Flags

  5. Multiplexing in TCP • Use of • source port • destination port

  6. TCP (and UDP) Port Numbers- Server • Servers use well-known port numbers for their major applications. • Port 80 = HTTP • Ports 20, 21 = FTP • Port 21 for supervisory information • Port 20 for file transfers • Port 23 = Telnet • Port 25 = SMTP (E-mail)

  7. 常見TCP/IP應用服務與埠號 UDP TCP 21 FTP 23 Telnet 25 SMTP 53 DNS 79 Finger 80 HTTP 110 POP3 119 NNTP 123 NTP 53 DNS 67 BOOTP 69 TFTP 161 SNMP 162 SNMP-Trap Port: 0~1023,網際網路標準專用

  8. TCP (and UDP) Port Numbers- Client 暫時的 短命的 • Clients Use Ephemeral Port Numbers. • By IETF rules, Ports 49152 to 65535. • Windows follows the rules. • Unix programs usually do not. • The client chooses a random ephemeral port number for each new connection.

  9. Range of TCP (and UDP) Port Numbers • 0~1023 • The range for assigned ports managed by the IANA • 1024~49151 • Registered Port Numbers • For non-major applications. • Unix does not follow the rule. • Uses some of these port numbers as ephemeral port numbers. • 49152~65535 • Ephemeral Port Numbers • Dynamic and/or Private Ports • Port numbers: • http://www.iana.org/assignments/port-numbers

  10. Socket • A socket is an IP address, a colon, and a port number. • Example: 128.171.17.13:80 • For servers, specifies a specific application on a specific server. • For clients, specifies a specific connection on a specific client.

  11. Use of TCP (and UDP) Port Numbers Ephemeral Source Port Number (50047) Client 60.171.18.22 From: 60.171.18.22:50047 To: 1.33.17.13:80 Well-Known Destination Port Number (80) Webserver 1.33.17.13 Port 80 A connection has both A source and destination socket. Based on the packet IP addresses and the TCP or UDP port number fields SMTP Server 123.30.17.120 Port 25

  12. Use of TCP (and UDP) Port Numbers Client 60.171.18.22 From: 60.171.18.22:50047 To: 1.33.17.13:80 If a client connects to two servers, it will select different ephemeral port numbers (50047 and 60003) for the two connections Webserver 1.33.17.13 Port 80 From: 60.171.18.22:60003 To: 123.30.17.120:25 SMTP Server 123.30.17.120 Port 25

  13. Sequence & Acknowledge Number • Sequence Number (SN) • All octets sent within a TCP connection are numbered sequentially. The number is started from ISN+1. • The sequence number of the first octet of this segment. • Acknowledge Number (AN) • If AN = j, all octets through SN= j-1have been received successfully. • Next expected segment will begin from octet j. ISN: Initial Sequence Number

  14. Sequence & Acknowledge Number Client Transport Process Server Transport Process Data (SN = 7000, length = 1460) ACK (AN = 8460) Data (SN=20000, length = 800) ACK (AN = 20800)

  15. Data Offset (4 bits) • Header length • The number of 32-bit words in the TCP header. • This indicates where the data begins. • The length of the TCP header is always a multiple of 32 bits.

  16. Flags (8 bits) • CWR (Congestion Window Reduced) • To indicate that the sending host received a TCP segment with ECE set. • ECE (ECN-Echo) • To indicate that the TCP peer is ECN capable during 3-way handshake • URG: Urgent pointer field is significant • ACK: Acknowledgement field is significant • PSH: Push function • RST: Reset the connection • SYN: Synchronize sequence numbers • FIN: No more data from sender

  17. TCP Operations • TCP Connection • Connection Establishment • Three-way handshaking • Data Transfer • Acknowledgement • Retransmission of lost packets • Discarding duplicate packets • Use of Window • Connection Termination • Four-way handshaking

  18. Connection Establishment • TCP three-way handshaking Passive Open Active Open Client Transport Process Server Transport Process 1. SYNi 2. SYNj, ACKi+1 3. ACKj+1 i: Client’s initial sequence number (ISN) j: Server’s initial sequence number (ISN)

  19. Connection Termination • TCP four-way handshaking Client Transport Process Server Transport Process 1. FINi 2. ACKi 3. FINj 4. ACKj * 2 & 3 can be combined  three-way handshaking

  20. Relative sequence number

  21. Data Transfer • Acknowledgement Client Transport Process Server Transport Process Data (c1) ACK (of data c1) Data (s1) ACK (of datas1)

  22. Retransmission of lost packets Client Transport Process Server Transport Process Data (c1) X Retransmission Timeout Data (c1) retransmit ACK (of data c1) Data (s1) ACK (of data s1)

  23. Discarding duplicate packets Client Transport Process Server Transport Process Data (c1) Retransmission Timeout ACK (of c1) X retransmit Data (c1) duplicated Discard it. Data (s1) ACK (of s1)

  24. TCP state diagram

  25. Window • TCP Window Size • How many more octets it can transmit before getting another acknowledgement. • Sender receives a TCP segment with AN=i, W=j. • Sender knows that the receiver has received octets before i. • Sender can send octets i ~ i+j-1. • Improve the stop-and-wait scheme, in which only one PDU at a time can be in transit. • Sender receives a TCP segment with W=0. • Cannot send any more octets • Flow control

  26. 17520 (3718091612 ~ 3718091612+17519)

  27. 3718091612 + 1460 = 3718093072 16060 (3718093072 ~ 3718091612+17519)

  28. = 3718091612 + 1460 3718093072 + 1460 = 3718094532 13600 (3718094532 ~ 3718091612+17519)

  29. = 3718093072 + 1460 17520 (3718094532 ~ 3718094532+17519)

  30. TCP Options • Maximum segment size • Included in SYN segment • Window scale • Included in SYN segment • Window field gives credit allocation in octets • With Window Scale value in Window field multiplied by 2F • F is the value of window scale option • Sack-permitted • Selective acknowledgement allowed • Sack • Receiver can inform sender of all segments received successfully • Sender retransmit segments not received • Timestamps • Send timestamp in data segment and return echo of that timestamp in ACK segment

  31. Transport Protocol Timers

  32. UDP • User Datagram Protocol (UDP) • Connectionless • RFC 768 • Connectionless service for application level procedures • Unreliable • Delivery and duplication control not guaranteed • Reduced overhead • e.g. network management

  33. UDP Uses • Inward data collection • Outward data dissemination • Request-Response • Real time application

  34. UDP Header

More Related