1 / 33

TCP

TCP. CST 415. Topics. Definitions Motivation Properties. Definitions. TCP – T ransmission C ontrol P rotocol IP provides unreliable packet delivery. Send it and forget it

diallo
Télécharger la présentation

TCP

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. TCP CST 415 CST 415 - Computer Networks

  2. Topics • Definitions • Motivation • Properties CST 415 - Computer Networks

  3. Definitions • TCP – Transmission Control Protocol IP provides unreliable packet delivery. • Send it and forget it TCP sits on top of IP and adds the functionality to turn a unreliable packet delivery into reliable packet delivery. Reliable Delivery – The packet is guaranteed to get to the recipient. CST 415 - Computer Networks

  4. Definitions • TCP – Transmission Control Protocol TCP is a stream oriented transport service. • On the application layer, information is transferred as a stream of bits. • The TCP layer breaks the information into octets and groups them into packets. • The sender sends a stream of octets. • The receiver receives the stream of octets in the same order the sender sent them. CST 415 - Computer Networks

  5. Motivation for TCP With IP as a transport mechanism: • Packets can be lost in transit across a network. • Fragmented packets may arrive out of order. • Pieces of a fragmented packet may be lost. • Duplicate packets may be delivered. CST 415 - Computer Networks

  6. Motivation for TCP If IP were our only method for delivering packets over a network, application programmers would have to manage packet transmission. • Build an ACK/NAK protocol. CST 415 - Computer Networks

  7. TCP The definition of TCP provides for an efficient protocol to avoid the necessity of application programs providing their own “ack/nack” protocol. CST 415 - Computer Networks

  8. TCP – Properties • Stream Oriented – Sender sends a stream of octets. Receiver receives those octets in the order the sender sent them. • Virtual Circuit Based – Even though the data transmission is connectionless (e.g. over IP), the sender and receiver perceive they are communicating over a circuit (analogous to a phone call). CST 415 - Computer Networks

  9. TCP – Properties • Buffered Transfer – Underlying protocol software will choose an optimal transmission size. TCP will buffer data until it gets a packet the size it wishes to send. • To avoid buffering, data must be “pushed” through the stream. • Unstructured Stream – Hey, let’s face it…bits is bits. • Full Duplex Communications – From the application point of view, sending and receiving of information can be done concurrently. CST 415 - Computer Networks

  10. Reliability Simple Ack Protocol A Full Success Scenario (nothing lost) CST 415 - Computer Networks

  11. Reliability Simple Ack Protocol Packet Lost Scenario CST 415 - Computer Networks

  12. Reliability • Sliding window protocol • Set up a window for packet “group” transmission. • Move the window forward as the sequence of packets gets “acked” by the receiver. • Allow the receiver to “ack” groups of packets. • Packets not “acked” will be retransmitted. CST 415 - Computer Networks

  13. Reliability – SWP Example CST 415 - Computer Networks

  14. Reliability – SWP Example CST 415 - Computer Networks

  15. Reliability – SWP Example CST 415 - Computer Networks

  16. Reliability – SWP Example CST 415 - Computer Networks

  17. Reliability – SWP Example CST 415 - Computer Networks

  18. Reliability – SWP Example CST 415 - Computer Networks

  19. Reliability – SWP Example CST 415 - Computer Networks

  20. Reliability – SWP Example CST 415 - Computer Networks

  21. Reliability – SWP Example CST 415 - Computer Networks

  22. Reliability • The protocol can work with different Ack/Nack schemes. • Go back N : This is what was shown above. • Assume everything up to the last acknowledged packet is good. Resend everything after. • Selective Nack : Allow the receiver to request retransmission of selected packets. • Timer Retransmit : Set a timer for each sent packet. • If a packet timer expires, resend the packet. CST 415 - Computer Networks

  23. TCP – Sliding Window • TCP uses a modification of the sliding window protocol. • Window size is adjusted “on the fly” • This allows the receiver to “throttle” down the sender. • Receiver send a window size along with each ack. • This forces the sender to either • Increase window size – send faster please • Decrease window size – slow down transmission please CST 415 - Computer Networks

  24. TCP – Sliding Window • TCP uses a modification of the sliding window protocol. • The window is on a “per byte” granularity. • Ack messages are sent for individual bytes. • The Ack message sends along the sequence number of the next byte to send. • The next byte to send will be the next byte of the longest contiguous sequence of bytes received so far. CST 415 - Computer Networks

  25. TCP – Sliding Window • Retransmission is based on a timer. • When TCP sends a segment of information, it will start a timer for that segment. • If the sender does not receive an “ack” containing a sequence number covering the sent segment before the timer expires, the sender will resend the expired segment. • To accommodate varying message latency times, TCP performs continuous monitoring of “send-ack” pairs and adjusts it’s timers dynamically. CST 415 - Computer Networks

  26. TCP – Ports/Connections/Endpoints • Just like UDP, TCP uses ports as logical addressing. • Provides associations between peer applications. • Applications are addressed via port and IP address. • This provides a unique address for a specific application running on a specific hardware device. • The combination is known as an “endpoint”. • Unlike UDP, TCP is connection based. • TCP requires a logical division of labor in applications. • TCP must operate in a client/server mode. • Server actively waits for a connection on a specific TCP port. • Clients will connect to that port to begin communication. CST 415 - Computer Networks

  27. TCP – Ports/Connections/Endpoints TCP lives in the transport layer along with UDP. Therefore TCP messages will be carried as data in an IP packet. CST 415 - Computer Networks

  28. TCP – Ports/Connections/Endpoints Server State Machine CST 415 - Computer Networks

  29. TCP – Ports/Connections/Endpoints • Open Port – The server opens the logical TCP port. • Listen – The server listens to the port, waiting for any incoming connection requests. • Spawn Connection Handler – Upon receiving a connection request, the server will spawn off a thread to handle the connection. • At this stage, the server may get a private TCP port and assign it to the handler thread. • Communication will be performed over this private port from within the handler thread. • Confirm Connection – The server sends a confirmation message to the client. • In this confirmation message, the server will send the private port # to be used for further communication. CST 415 - Computer Networks

  30. TCP – Ports/Connections/Endpoints • Handle Server Thread – Given the new private logical port: • Wait for activity on the logical port. • Send/Receive protocol is controlled at the application layer by application logic. • This logic is built into the server application handler thread. • Handle Send – Send a message to the peer endpoint. • Handle Receive – Receive a message from the peer endpoint and process it. CST 415 - Computer Networks

  31. TCP – Ports/Connections/Endpoints Note: For a TCP server to operate properly, the server must be capable of handling interaction from multiple clients. CST 415 - Computer Networks

  32. TCP – Ports/Connections/Endpoints Client State Machine CST 415 - Computer Networks

  33. TCP – Ports/Connections/Endpoints • Connection Request – The client requests a connection given the server IP address and TCP port number. • Connection Confirm – The server responds with a confirmation message passing a private logical port on which further communication will be performed. • Handle Client Thread – Given the new private logical port: • Wait for activity on the logical port. • Send/Receive protocol is controlled at the application layer by application logic. • This logic is built into the client/server peer applications. • Handle Send – Send a message to the peer endpoint. • Handle Receive – Receive a message from the peer endpoint and process it. CST 415 - Computer Networks

More Related