Unformatted text preview:

Transport Layer CPSC 363 Computer Networks Ellen Walker Hiram College Includes figures from Computer Networking by Kurose Ross Addison Wesley 2002 Internet Layers Application Transport provides logical connections between processes running on different computers Network Data Link Physical Transport Layer Protocols UDP User Datagram Protocol Unreliable Connectionless TCP Transmission Control Protocol Reliable Connection oriented Flow control and congestion control Both depend on IP Network Layer which is best effort no guarantees of in order delivery or of delivery of all segments Services Provided by Transport Layer UDP and TCP Multiplexing Demultiplexing combine split messages for different processes on the same host according to port number Error Detection TCP only Flow control sequencing handshaking to ensure reliable transfer Congestion control regulating rate at which sender can add traffic to the network UDP vs TCP UDP for network infrastructure e g routing protocol DNS Need info when net is congested UDP vs TCP cont d Multimedia e g streaming files and Internet Telephony use UDP or TCP with proprietary protocols Can tolerate some packet loss Congestion control causes poor performance BUT need to be good net citizen AND security blocks on UDP UDP Segment Destination port chooses a socket Source port for return address Checksum for error checking Application never sees the header Source port Dest Port Length Checksum data data data data Sending a UDP message 1 Construct the Header Insert appropriate source and destination port numbers Calculate checksum Divide data into words e g 16 bits Add them all up overflow wraps around Flip each bit 2 Pass frame to Network layer for delivery to the destination host Receiving a UDP Message 1 Receive frame from Network layer 2 Check for errors Add up all words and the checksum If the sum is not 1111111111111111 there is an error 3 If no error pass the message to the appropriate socket based on port number 4 If there is an error either discard the frame or pass it to the socket with a warning TCP is More Complex Multiplexing demultiplexing based on source port destination port source address and destination address Different sources may go to different sockets Special socket for new connections no process yet If the new connection is accepted a socket and process is created for it TCP provides additional services reliable transport State machine State machine abstraction At any time the process is in a state Each time an event happens the process takes an action and goes to the next state We can describe the entire algorithm as a diagram where each state has an arrow for each event action pair to the next appropriate state State Machine for a Kitten Happy Food available Eat Hungry Toys available Play Sleeping X hrs passed Awaken State Machine Send Receive 1 Sender waiting Receiver waiting Data from appl to send make packet send to network Data received from network extract data deliver to appl Assumption network is completely reliable State Machine Send Receive 2 Data from appl to send waiting make packet send to network Sender for appl Receive NAK from network Resend packet waiting Receive ACK from network for ACK nothing to do Receiver waiting Receive OK packet send ACK deliver data Receive bad packet send NAK Assumption all frames delivered but some are corrupt Problem What if ACK NAK is corrupt State Machine Send 2 1 Data from appl to send wait make packet 0 send to network for appl Receive corrupt or NAK 0 wait Resend packet for ACK Receive ACK from network 0 nothing to do Receive ACK from network nothing to do Receive corrupt or NAK wait Resend packet wait for ACK for appl 1 1 Data from appl to send make packet 1 send to network Comments on Send 2 1 Each frame now has a sequence number 0 or 1 Treat a corrupt packet received as NAK If it was really NAK no harm done If it was really ACK extra data will be sent Sequence numbers allow duplicate packets to be recognized 2 0 s or 1 s in a row State Machine Receive 2 1 Receive OK packet 1 send ACK wait 0 Receive OK packet 0 send ACK deliver data Receive corrupt packet send NAK Receive OK packet 1 send ACK deliver data wait 1 Receive OK packet 0 send ACK Receive bad packet send NAK ACK all non corrupt packets but only deliver packets with the correct sequence number to the application V 2 2 Uses only ACK s Each ACK contains the sequence number of the packet being acknowledged Instead of NAK resend last ACK If the ACK is for the wrong packet it s really a NAK Assume packets 0 OK 1 corrupt Packet 0 sent Packet 0 received ACK 0 sent ACK 0 received packet 1 sent Packet 1 corrupt ACK 0 last ACK resent ACK 0 received packet 1 resent like NAK from before Summary So Far Protocol 1 perfect transmission channel Outside of data no communication needed Protocol 2 some packets are corrupt Each packet must be acknowledged Until ACK received no new packets can be sent Packet sequence numbers avoid problems with corrupt acknowledgement message ACK vs NAK or ACK1 vs ACK0 Protocol 3 some packets get lost Packet Loss in v 2 2 If the data is lost Receiver never receives the data stuck in wait 0 or wait 1 state Sender therefore doesn t get ACK stuck in wait ACK 0 If the ACK is lost Receiver received the data sent ACK Sender doesn t get ACK state stuck in wait ACK 0 No additional data can be sent Adding a Timer If we had to wait too long assume packet was lost Might not really be lost might be just delayed Lost packets are resent If not lost they are duplicates will be ignored as for corrupt packets How long to wait Minimum is 1 RTT Too short many packets are duplicated Too long overall transmission is slowed State Machine Send 3 0 Data from appl to send make packet 0 send to network wait Start timer Receive corrupt or ACK 1 for appl nothing to do 0 wait for ACK Receive ACK from network Timeout 0 nothing to do Resend packet Timeout Resend packet Receive ACK from network nothing to do Receive corrupt or ACK 0 wait nothing to do for ACK 1 Data from appl to send make packet 1 send to network Start timer wait for appl 1 Operation of Protocol 3 0 fig 3 16a b Operation of Protocol 3 0 Fig 3 16c d Summary Components of Reliable Data Transfer Checksum to recognize a corrupt packet Alternating sequence numbers to recognize duplicate packets Acknowledgements to communicate when a packet was successfully received Timer to determine when a packet or its acknowledgement was lost Pipelined Reliable Data Transfer Protocol 3


View Full Document

Hiram CPSC 363 - Transport Layer

Pages: 55
Loading Unlocking...
Login

Join to view Transport Layer and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Transport Layer and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?