Transport service characterization The Transport Layer End-to-End Protocols: UDP and TCP Connection establishment (if connection-oriented) Data transfer Reliable ( TCP) Unreliable / best effort ( UDP) Of normal data / prioritized data Flow control Congestion control Connection release (if conn-oriented) y the user y the service provider, if problems arise ddressing the transport user Who is that anyway? pplication programmer s interface PPS Internet-Praktikum Transportprotokolle TCP 1 PPS Internet-Praktikum Transportprotokolle TCP 3 Layered view of internetworking example Problems with connection establishment Transport protocol data Timeout CC Conn. established CC t??? CC Conn. released PPS Internet-Praktikum Transportprotokolle TCP 2 -Connect Reuest CC-Connect Confirmation PPS Internet-Praktikum Transportprotokolle TCP 4 --> 3-way handshaking
Problems with data transfer Connection establishment using the socket PI Server Client DT1 DT3 DT2 Timeout DT1 DT1? Serverinstall socket() bind() listen() accept() blocked Conn. established socket() connect() read() Data (reuest) write() Handles reuest Seuence error duplicate t write() Data (response) read() PPS Internet-Praktikum Transportprotokolle TCP 5 PPS Internet-Praktikum Transportprotokolle TCP 7 Problems with connection release ddressing application processes DTn P1 P2 P3 37 1245 56 Port numbers DR DTn+1 Connection released 4 UDP Proto=17 Internet Physical network Loss of data 3 IP Router Host PPS Internet-Praktikum Transportprotokolle TCP 6 PPS Internet-Praktikum Transportprotokolle TCP 8
ssignment of port numbers symmetric c/s model, realized by socket PI Passive entity binds to a specific port (bind()) ctive entity sends a reuest or established a connection to the port of the server (connect()). Port numbers may be assigned statically to applications: entries in a data base mapping ports to applications (/etc/services). Well known ports globally co-ordinated. lternatively: dynamic assignment via a directory service (local or distributed) Co-ordination of globally assigned ports Internet ssigned Numbers uthority (IN, http://www.iana.org/) Responsible for the assignment of protocol parameters and constants (port numbers, protocol numbers,...) Range of ports 0.. 1023: for global "well known" ports, assigned by IN Range of ports 1024.. 65535: vailable for dynamic allocation by processes or static allocation in a private context Registration by IN is optional Current assignments see general: http://www.iana.org/numbers/ port numbers: http://www.iana.org/assignments/port-numbers PPS Internet-Praktikum Transportprotokolle TCP 9 PPS Internet-Praktikum Transportprotokolle TCP 11 Well-known port numbers: /etc/services (extract) User Datagram Protocol (UDP) # Note that it is presently the policy of IN to assign a single well-known # port number for both TCP and UDP; hence, most entries here have two entries # even if the protocol doesn't support UDP operations. # Updated from RFC 1700, ssigned Numbers echo 7/tcp echo 7/udp discard 9/tcp sink null discard 9/udp sink null ftp-data 20/tcp ftp 21/tcp telnet 23/tcp smtp 25/tcp mail time 37/tcp timserver time 37/udp timserver nameserver 42/tcp name # IEN 116 whois 43/tcp nicname domain 53/tcp nameserver # name-domain server domain 53/udp nameserver Connectionless datagram service dded functionality (beyond IP datagram) application addressing using ports Error checking No specific uality of service mechanisms Checksum computed over UDP header and payload pseudo-header, three fields from the IP header protocol number source IP address destination IP address UDP length field (second time) PPS Internet-Praktikum Transportprotokolle TCP 10 PPS Internet-Praktikum Transportprotokolle TCP 12
Transmission Control Protocol (TCP) Connection-oriented Full-duplex connection Provides a byte pipe Unstructured byte stream Sliding window protocol Seuence numbers are byte numbers Maximum window size is 2 16 bytes (may be scaled) Sender window is variable, determined by the minimum of Reuest of the receiver (receiver window size) Estimation of the network load (congestion window size, slow start algorithm) Format of a TCP Segment 0 4 10 16 31 SrcPort HdrLen 0 Flags Checksum SeuenceNum cknowledgment Options (variable) Data DstPort dvertisedwindow UrgPtr Code its: URG, CK, PSH, RST, SYN, FIN UrgPtr (urgent pointer): points to the end of urgent data in the pet PPS Internet-Praktikum Transportprotokolle TCP 13 PPS Internet-Praktikum Transportprotokolle TCP 15 asic operation of TCP Format of a TCP Segment TCP data units are variable length segments; segment size set at connection setup Each segment has a seuence number, which specifies its position in the byte stream Segments sent must be nowledged with in a given time (based on an adaptive estimation of the round trip time (RTT)) cknowledgements are sent with delay (appr. 200 ms) Each segment has an end-to-end checksum; segments with wrong checksum are ignored The receiver sorts received segments according to their seuence number; duplicates are ignored 0 4 10 16 31 SrcPort HdrLen 0 Flags SeuenceNum cknowledgment Checksum computation Checksum uses pseudo-header UrgPtr Options (variable) Data DstPort dvertisedwindow Code its: URG, CK, PSH, RST, SYN, FIN UrgPtr (urgent pointer): points to the end of urgent data in the pet PPS Internet-Praktikum Transportprotokolle TCP 14 PPS Internet-Praktikum Transportprotokolle TCP 16
Conn. establishment with 3-way handshaking Initial seuence numbers are randomly chosen, within bounds 3-way handshaking needed since IP is unreliable Release of a TCP connection ctive entity (left) s the connection with a segment with FIN flag set No new data sent from the left, but data from the right entity are still accepted and nowledged 4-way handshake, each side is d separately (TCP half ) ctive participant (client) Passive participant (server) Send FIN se=x Recv. FIN Send CK x+1 recv. CK Inform application send FIN, CK x+1 Last ck may contain data recv. FIN + CK Send CK y+1 recv. CK PPS Internet-Praktikum Transportprotokolle TCP 17 PPS Internet-Praktikum Transportprotokolle TCP 19 Sample problem scenarios Client anything / Finite state machine of TCP begin d old duplicate old duplicate passive open active open / receiv. / + listen / + send / + / sent / timeout / old duplicate established Is rejected 1 closing last / 2 - / / / timed timeout after 2 segment lifetimes aus: D. Comer: Internetworking with TCP/IP, Volume 1, Prentice Hall, 1995, p. 220 PPS Internet-Praktikum Transportprotokolle TCP 18 PPS Internet-Praktikum Transportprotokolle TCP 20
Server receiv. 1 2 begin / + passive open anything / d listen established closing timed / + - / / / send / Finite state machine of TCP + / active open / sent last timeout after 2 segment lifetimes / timeout / / Host (client machine) Client 1 (tcp, :1055) Client 2 (tcp, :1056) Example mechanism of setting up two simultaneous TCP connections to the same application (tcp,, 1055,, 23) (tcp,, 1056,, 23) Host (server machine) Daemon (tcp, *, 23) Server 1 (tcp,, 23) Server 2 (tcp,, 23) fork aus: D. Comer: Internetworking with TCP/IP, Volume 1, Prentice Hall, 1995, p. 220 PPS Internet-Praktikum Transportprotokolle TCP 21 PPS Internet-Praktikum Transportprotokolle TCP 23 Connections and connection end-points TCP connection is identified by a 4-tuple IP-address and port number of host (:P ) IP-address and port number of host (:P ) More than one TCP-connection may be established between the same two hosts n IP pet belongs to a specific TCP connection if the 4 values match and if the IP protocol field has the value of TCP PPS Internet-Praktikum Transportprotokolle TCP 22