Presentation is loading. Please wait.

Presentation is loading. Please wait.

Networked & Distributed Systems TCP/IP Transport Layer Protocols UDP and TCP University of Glamorgan.

Similar presentations


Presentation on theme: "Networked & Distributed Systems TCP/IP Transport Layer Protocols UDP and TCP University of Glamorgan."— Presentation transcript:

1 Networked & Distributed Systems TCP/IP Transport Layer Protocols UDP and TCP University of Glamorgan

2 What do I cover? what is left from TCP/IP Protocols: n Transport Layer Protocols ä UDP ä TCP in more details n Upper layer protocols ä (RARP), BOOTP, DHCP ä DNS n Application Layer Protocols ä Telnet, FTP (TFTP), SMTP (POP3)

3 Transport Layer Protocols TCP and UDP

4 Transport Layer Protocols n 2 main protocols TCP & UDP n TCP – transmission control protocol ä Connection oriented ä Reliable –sequence of numbered segments & acknowledgments with any required re- transmissions ä Flow control – sliding windows n UDP – user datagram protocol ä Connectionless ä Unreliable delivery of single segments (datagrams) ä Errors detected but not corrected (No acks)

5 TCP/UDP analogies n TCP as a telephone call ä Make a connection – ring number –Verifies connectivity ä Use connection – communicate –Reliability “can you repeat that please?” –Flow control – normal human courtesy ä Close connection – receiver down n UDP as a letter ä Write it, address it, post it, hope it gets there

6 TCP vs UDP n Relative merits n TCP ä Reliable ä High network overheads ä Complex and large software n UDP ä Unreliable (may not be a problem) ä Low network overheads ä Simple and small software

7 When to use UDP n Use TCP unless there is a reason for UDP n Possible reasons to use UDP ä When the network efficiency is needed (SNMP) ä When the sw simplicity is needed (Bootstrap loading) ä When the reliability of TCP is counter- productive (Stream audio/video)

8 User Datagram Protocol (UDP) n UDP and the TCP/IP layered model n UDP message format n UDP and encapsulation n UDP checksum

9 UDP And The TCP/IP Layered Model

10 Multiplexing and Demultiplexing – 1

11 Multiplexing and Demultiplexing – 2

12 How Do We Allocate Port Numbers? n Well known port numbers n Dynamic binding

13 Port numbers n 0 to 255public port numbers n 256 to 1023assigned to companies for n their own marketable apps n 1024+unregulated

14 Examples of public ports

15 UDP Message Format

16 UDP and Encapsulation

17 UDP Checksum n Optional checksum calculated on ä UDP datagram ä UDP pseudo-header ä Does this violate layering?

18 UDP Checksum

19 Differences between TCP & UDP FeatureUDPTCP AnalogyLetter PostPhone Call Connection PhaseNoneYes MessagesIndividual, unrelatedSequence Lost MessageUser has to deal with loss Protocol tries to recover Message Order Maintained? NoYes Disconnection PhaseNoYes Duplicate MessagesMaybeNo ComplexityLowHigh

20 Properties of a Reliable Delivery Service n Stream Orientation – Application just transfers a stream of bytes n Virtual Circuit Connection – Is TCP VC? n Buffered Transfer – TCP decides what size TCP messages are, not user n Unstructured Stream – There is no structure in the stream of bytes as far as TCP is concerned n Full Duplex Connection – Can transfer data in both directions simultaneously and independently

21 Positive Acknowledgement A Simple Example

22 Positive Acknowledgement Packet Doesn’t Arrive

23 Positive Acknowledgement ACK Doesn’t Arrive

24 Round Trip Time (RTT)

25 Round Trip Time (RTT) Estimate too low

26 Round Trip Time (RTT) Estimate too high

27 Sending Multiple Packets n Receiver may not be able to process packets as fast as they arrive n In fact ACK’s serve at least 3 different purposes ä Recovery from lost packets ä Limit the rate at which sender can send packets ä Control congestion in the network n Compromise solution is required: The Sliding Window

28 Sliding Windows – Example n Given a window size = 6 packets n A has sent packets 1 to 7 n A has received ACK’s 1 to 4

29 Sliding Windows ACK Received n A receives ACK 5 and the window slides to the right

30 Sliding Windows Packet 8 sent n A sends Packet 8 and the window remain unchanged

31 Sliding Windows Packet 9 sent n A sends Packet 9 and the window remain unchanged

32 Sliding Windows Packet 6 ACK-ed n A receives ACK for Packet 6 and the window slides to the right

33 Sliding Windows Packet 6 ACK-ed n A sends packets 10, 11, and 12. No ACK received  no more packets can be sent.

34 Sliding Windows Window size? Different protocols fix the window size in different ways ä Fixed by protocol specification ä Agreed when connection established ä Adjusted whilst connection in progress (Demo is given later)

35 Sliding Windows Missing ACK’s ? n With just one outstanding ACK it was easy. If A doesn’t get an ACK it sends the packet again n With several ACK’s outstanding it gets much more complicated n What does A do when it detects a missing ACK? n What does B do when it detects a missing packet? n Different protocols use different solutions

36 Sliding Windows Missing ACK’s ? n There are two “extreme” positions ä When something goes missing A resends every packet starting with the first unacknowledged packet. This is called Go-Back-N. ä When something goes missing A & B co- operate to just resend those packets B hasn’t received. This is called Selective Retransmission.

37 TCP Encapsulation

38 TCP Header

39 TCP Header Fields n Source Port : Port number of sender of segment n Destination Port : Port number of intended recipient n Sequence Number : TCP uses byte numbers not packet numbers n Acknowledgement Number : Number of the byte the sender of this segment expects next n Window : The size of the sliding window in bytes n Checksum : Just like the UDP checksum n Control bits : Special purpose bits n Data: User data

40 Usage of SEQ-ACK-WIN Fields Example

41 TCP is Complicated n RFC 793 is over 90 pages long – but doesn’t cover everything n There are a number of additional RFC’s covering various aspects of TCP n There are a number of “reference implementations” which have performance enhancing features n There is no single TCP specification

42 Next : TCP continues n Establishing A TCP Connection n Timeouts and Retransmission n Congestion n Push n Silly Window Syndrome n Closing A TCP Connection


Download ppt "Networked & Distributed Systems TCP/IP Transport Layer Protocols UDP and TCP University of Glamorgan."

Similar presentations


Ads by Google