William Stallings Data and Computer Communications Chapter 17

  • Slides: 60
Download presentation
William Stallings Data and Computer Communications Chapter 17 Transport Protocols

William Stallings Data and Computer Communications Chapter 17 Transport Protocols

Connection Oriented Transport Protocol Mechanisms z Logical connection z Establishment z Maintenance termination z

Connection Oriented Transport Protocol Mechanisms z Logical connection z Establishment z Maintenance termination z Reliable z e. g. TCP

Reliable Sequencing Network Service z Assume arbitrary length message z Assume virtually 100% reliable

Reliable Sequencing Network Service z Assume arbitrary length message z Assume virtually 100% reliable delivery by network service ye. g. reliable packet switched network using X. 25 ye. g. frame relay using LAPF control protocol ye. g. IEEE 802. 3 using connection oriented LLC service z Transport service is end to end protocol between two systems on same network

Issues in a Simple Transprot Protocol z Addressing z Multiplexing z Flow Control z

Issues in a Simple Transprot Protocol z Addressing z Multiplexing z Flow Control z Connection establishment and termination

Addressing z Target user specified by: y. User identification x. Usually host, port •

Addressing z Target user specified by: y. User identification x. Usually host, port • Called a socket in TCP x. Port represents a particular transport service (TS) user y. Transport entity identification x. Generally one per host x. If more than one, then usually one of each type • Specify transport protocol (TCP, UDP) y. Host address x. An attached network device x. In an internet, a global internet address y. Network number

Finding Addresses z Four methods y. Know address ahead of time xe. g. collection

Finding Addresses z Four methods y. Know address ahead of time xe. g. collection of network device stats y. Well known addresses y. Name server y. Sending process request to well known address

Multiplexing z Multiple users employ same transport protocol z User identified by port number

Multiplexing z Multiple users employ same transport protocol z User identified by port number or service access point (SAP) z May also multiplex with respect to network services used ye. g. multiplexing a single virtual X. 25 circuit to a number of transport service user x. X. 25 charges per virtual circuit connection time

Flow Control z Longer transmission delay between transport entities compared with actual transmission time

Flow Control z Longer transmission delay between transport entities compared with actual transmission time y. Delay in communication of flow control info z Variable transmission delay y. Difficult to use timeouts z Flow may be controlled because: y. The receiving user can not keep up y. The receiving transport entity can not keep up z Results in buffer filling up

Coping with Flow Control Requirements (1) z Do nothing y. Segments that overflow are

Coping with Flow Control Requirements (1) z Do nothing y. Segments that overflow are discarded y. Sending transport entity will fail to get ACK and will retransmit x. Thus further adding to incoming data z Refuse further segments y. Clumsy y. Multiplexed connections are controlled on aggregate flow

Coping with Flow Control Requirements (2) z Use fixed sliding window protocol y. See

Coping with Flow Control Requirements (2) z Use fixed sliding window protocol y. See chapter 7 for operational details y. Works well on reliable network x. Failure to receive ACK is taken as flow control indication y. Does not work well on unreliable network x. Can not distinguish between lost segment and flow control z Use credit scheme

Credit Scheme z Greater control on reliable network z More effective on unreliable network

Credit Scheme z Greater control on reliable network z More effective on unreliable network z Decouples flow control from ACK y. May ACK without granting credit and vice versa z Each octet has sequence number z Each transport segment has seq number, ack number and window size in header

Use of Header Fields z When sending, seq number is that of first octet

Use of Header Fields z When sending, seq number is that of first octet in segment z ACK includes AN=i, W=j z All octets through SN=i-1 acknowledged y. Next expected octet is i z Permission to send additional window of W=j octets yi. e. octets through i+j-1

Credit Allocation

Credit Allocation

Sending and Receiving Perspectives

Sending and Receiving Perspectives

Establishment and Termination z Allow each end to now the other exists z Negotiation

Establishment and Termination z Allow each end to now the other exists z Negotiation of optional parameters z Triggers allocation of transport entity resources z By mutual agreement

Connection State Diagram

Connection State Diagram

Connection Establishment

Connection Establishment

Not Listening z Reject with RST (Reset) z Queue request until matching open issued

Not Listening z Reject with RST (Reset) z Queue request until matching open issued z Signal TS user to notify of pending request y. May replace passive open with accept

Termination z Either or both sides z By mutual agreement z Abrupt termination z

Termination z Either or both sides z By mutual agreement z Abrupt termination z Or graceful termination y. Close wait state must accept incoming data until FIN received

Side Initiating Termination z TS user Close request z Transport entity sends FIN, requesting

Side Initiating Termination z TS user Close request z Transport entity sends FIN, requesting termination z Connection placed in FIN WAIT state y. Continue to accept data and deliver data to user y. Not send any more data z When FIN received, inform user and close connection

Side Not Initiating Termination z FIN received z Inform TS user Place connection in

Side Not Initiating Termination z FIN received z Inform TS user Place connection in CLOSE WAIT state y. Continue to accept data from TS user and transmit it z TS user issues CLOSE primitive z Transport entity sends FIN z Connection closed z All outstanding data is transmitted from both sides z Both sides agree to terminate

Unreliable Network Service z E. g. yinternet using IP, yframe relay using LAPF y.

Unreliable Network Service z E. g. yinternet using IP, yframe relay using LAPF y. IEEE 802. 3 using unacknowledged connectionless LLC z Segments may get lost z Segments may arrive out of order

Problems z Ordered Delivery z Retransmission strategy z Duplication detection z Flow control z

Problems z Ordered Delivery z Retransmission strategy z Duplication detection z Flow control z Connection establishment z Connection termination z Crash recovery

Ordered Delivery z Segments may arrive out of order z Number segments sequentially z

Ordered Delivery z Segments may arrive out of order z Number segments sequentially z TCP numbers each octet sequentially z Segments are numbered by the first octet number in the segment

Retransmission Strategy z Segment damaged in transit z Segment fails to arrive z Transmitter

Retransmission Strategy z Segment damaged in transit z Segment fails to arrive z Transmitter does not know of failure z Receiver must acknowledge successful receipt z Use cumulative acknowledgement z Time out waiting for ACK triggers re-transmission

Timer Value z Fixed timer y. Based on understanding of network behavior y. Can

Timer Value z Fixed timer y. Based on understanding of network behavior y. Can not adapt to changing network conditions y. Too small leads to unnecessary re-transmissions y. Too large and response to lost segments is slow y. Should be a bit longer than round trip time z Adaptive scheme y. May not ACK immediately y. Can not distinguish between ACK of original segment and re-transmitted segment y. Conditions may change suddenly

Duplication Detection z If ACK lost, segment is re-transmitted z Receiver must recognize duplicates

Duplication Detection z If ACK lost, segment is re-transmitted z Receiver must recognize duplicates z Duplicate received prior to closing connection y. Receiver assumes ACK lost and ACKs duplicate y. Sender must not get confused with multiple ACKs y. Sequence number space large enough to not cycle within maximum life of segment z Duplicate received after closing connection

Incorrect Duplicate Detection

Incorrect Duplicate Detection

Flow Control z Credit allocation z Problem if AN=i, W=0 closing window z Send

Flow Control z Credit allocation z Problem if AN=i, W=0 closing window z Send AN=i, W=j to reopen, but this is lost z Sender thinks window is closed, receiver thinks it is open z Use window timer z If timer expires, send something y. Could be re-transmission of previous segment

Connection Establishment z Two way handshake y. A send SYN, B replies with SYN

Connection Establishment z Two way handshake y. A send SYN, B replies with SYN y. Lost SYN handled by re-transmission x. Can lead to duplicate SYNs y. Ignore duplicate SYNs once connected z Lost or delayed data segments can cause connection problems y. Segment from old connections y. Start segment numbers fare removed from previous connection x. Use SYN i x. Need ACK to include i x. Three Way Handshake

Two Way Handshake: Obsolete Data Segment

Two Way Handshake: Obsolete Data Segment

Two Way Handshake: Obsolete SYN Segment

Two Way Handshake: Obsolete SYN Segment

Three Way Handshake: State Diagram

Three Way Handshake: State Diagram

Three Way Handshake: Examples

Three Way Handshake: Examples

Connection Termination z Entity in CLOSE WAIT state sends last data segment, followed by

Connection Termination z Entity in CLOSE WAIT state sends last data segment, followed by FIN z FIN arrives before last data segment z Receiver accepts FIN y. Closes connection y. Loses last data segment z Associate sequence number with FIN z Receiver waits for all segments before FIN sequence number z Loss of segments and obsolete segments y. Must explicitly ACK FIN

Graceful Close z Send FIN i and receive AN i z Receive FIN j

Graceful Close z Send FIN i and receive AN i z Receive FIN j and send AN j z Wait twice maximum expected segment lifetime

Crash Recovery z After restart all state info is lost z Connection is half

Crash Recovery z After restart all state info is lost z Connection is half open y. Side that did not crash still thinks it is connected z Close connection using persistence timer y. Wait for ACK for (time out) * (number of retries) y. When expired, close connection and inform user z Send RST i in response to any i segment arriving z User must decide whether to reconnect y. Problems with lost or duplicate data

TCP & UDP z Transmission Control Protocol y. Connection oriented y. RFC 793 z

TCP & UDP z Transmission Control Protocol y. Connection oriented y. RFC 793 z User Datagram Protocol (UDP) y. Connectionless y. RFC 768

TCP Services z Reliable communication between pairs of processes z Across variety of reliable

TCP Services z Reliable communication between pairs of processes z Across variety of reliable and unreliable networks and internets z Two labeling facilities y. Data stream push x. TCP user can require transmission of all data up to push flag x. Receiver will deliver in same manner x. Avoids waiting for full buffers y. Urgent data signal x. Indicates urgent data is upcoming in stream x. User decides how to handle it

TCP Header

TCP Header

Items Passed to IP z TCP passes some parameters down to IP y. Precedence

Items Passed to IP z TCP passes some parameters down to IP y. Precedence y. Normal delay/low delay y. Normal throughput/high throughput y. Normal reliability/high reliability y. Security

TCP Mechanisms (1) z Connection establishment y. Three way handshake y. Between pairs of

TCP Mechanisms (1) z Connection establishment y. Three way handshake y. Between pairs of ports y. One port can connect to multiple destinations

TCP Mechanisms (2) z Data transfer y. Logical stream of octets y. Octets numbered

TCP Mechanisms (2) z Data transfer y. Logical stream of octets y. Octets numbered modulo 223 y. Flow control by credit allocation of number of octets y. Data buffered at transmitter and receiver

TCP Mechanisms (3) z Connection termination y. Graceful close y. TCP users issues CLOSE

TCP Mechanisms (3) z Connection termination y. Graceful close y. TCP users issues CLOSE primitive y. Transport entity sets FIN flag on last segment sent y. Abrupt termination by ABORT primitive x. Entity abandons all attempts to send or receive data x. RST segment transmitted

Implementation Policy Options z Send z Deliver z Accept z Retransmit z Acknowledge

Implementation Policy Options z Send z Deliver z Accept z Retransmit z Acknowledge

Send z If no push or close TCP entity transmits at its own convenience

Send z If no push or close TCP entity transmits at its own convenience z Data buffered at transmit buffer z May construct segment per data batch z May wait for certain amount of data

Deliver z In absence of push, deliver data at own convenience z May deliver

Deliver z In absence of push, deliver data at own convenience z May deliver as each in order segment received z May buffer data from more than one segment

Accept z Segments may arrive out of order z In order y. Only accept

Accept z Segments may arrive out of order z In order y. Only accept segments in order y. Discard out of order segments z In windows y. Accept all segments within receive window

Retransmit z TCP maintains queue of segments transmitted but not acknowledged z TCP will

Retransmit z TCP maintains queue of segments transmitted but not acknowledged z TCP will retransmit if not ACKed in given time y. First only y. Batch y. Individual

Acknowledgement z Immediate z Cumulative

Acknowledgement z Immediate z Cumulative

Congestion Control z RFC 1122, Requirements for Internet hosts z Retransmission timer management y.

Congestion Control z RFC 1122, Requirements for Internet hosts z Retransmission timer management y. Estimate round trip delay by observing pattern of delay y. Set time to value somewhat greater than estimate y. Simple average y. Exponential average y. RTT Variance Estimation (Jacobson’s algorithm)

Use of Exponential Averaging

Use of Exponential Averaging

Jacobson’s RTO Calculation

Jacobson’s RTO Calculation

Exponential RTO Backoff z Since timeout is probably due to congestion (dropped packet or

Exponential RTO Backoff z Since timeout is probably due to congestion (dropped packet or long round trip), maintaining RTO is not good idea z RTO increased each time a segment is re-transmitted z RTO = q*RTO z Commonly q=2 y. Binary exponential backoff

Karn’s Algorithm z If a segment is re-transmitted, the ACK arriving may be: y.

Karn’s Algorithm z If a segment is re-transmitted, the ACK arriving may be: y. For the first copy of the segment x. RTT longer than expected y. For second copy z No way to tell z Do not measure RTT for re-transmitted segments z Calculate backoff when re-transmission occurs z Use backoff RTO until ACK arrives for segment that has not been re-transmitted

Window Management z Slow start yawnd = MIN[credit, cwnd] y. Start connection with cwnd=1

Window Management z Slow start yawnd = MIN[credit, cwnd] y. Start connection with cwnd=1 y. Increment cwnd at each ACK, to some max z Dynamic windows sizing on congestion y. When a timeout occurs y. Set slow start threshold to half current congestion window xssthresh=cwnd/2 y. Set cwnd = 1 and slow start until cwnd=ssthresh x. Increasing cwnd by 1 for every ACK y. For cwnd >=ssthresh, increase cwnd by 1 for each RTT

UDP z User datagram protocol z RFC 768 z Connectionless service for application level

UDP z User datagram protocol z RFC 768 z Connectionless service for application level procedures y. Unreliable y. Delivery and duplication control not guaranteed z Reduced overhead z e. g. network management (Chapter 19)

UDP Uses z Inward data collection z Outward data dissemination z Request-Response z Real

UDP Uses z Inward data collection z Outward data dissemination z Request-Response z Real time application

UDP Header

UDP Header

Required Reading z Stallings chapter 17 z RFCs

Required Reading z Stallings chapter 17 z RFCs