Presentation is loading. Please wait.

Presentation is loading. Please wait.

Chapter 5 Transport layer With special emphasis on Transmission Control Protocol (TCP)

Similar presentations


Presentation on theme: "Chapter 5 Transport layer With special emphasis on Transmission Control Protocol (TCP)"— Presentation transcript:

1 Chapter 5 Transport layer With special emphasis on Transmission Control Protocol (TCP)

2 Contents Need for TCP TCP functions – Segmentation – Reliability – Flow-control – Multiplexing – Connection establishment TCP Header UDP 2

3 The need for a Transport layer The network layer (IP) sends packets of data to their correct destinations with best effort – Packets may get lost in transit The maximum packet size in IP is 65,536 bytes – What happens if the application wants to send a file of size 5,000,000 bytes? Port addressing – Distinguish between applications on computers 3

4 The Transport layer in the stack

5 Transport Control Protocol (TCP) These (and other related jobs) are performed by the Transport layer TCP is a highly reliable host-to-host transport layer protocol over packet switched networks – Defined in RFC 793 (Sep 1981)RFC 793 5

6 Transport layer - reference TCP – RFC 793 (Sep 1981) RFC 793 UDP – RFC 768 (Aug 1980) RFC 768 6

7 TCP – Overview of operation At the sending end, the application creates the data to be sent and passes it to its TCP module for transmission At the receiving end, TCP collects all fragments from IP, reassembles them into the original data and passes it to the receiving application 7

8 TCP functions TCP provides a reliable application-to- application communication service over a network of arbitrary complexity and unreliability – Applications (such as browsers and email) simply pass the data to be transferred to TCP and leave all communication complexities to TCP 8

9 TCP functions TCP corrects for all possible imperfections of IP Therefore TCP has to perform many tasks – Segmentation – Reliability – Multiplexing – Flow-control – Connection establishment 9

10 TCP functions - segmentation TCP allows IP to transfer arbitrarily large data blocks – Accomplished by breaking data into segments – A sequence number is assigned to each datagram – Sequence numbers help receiver order datagrams even when received out of order 10

11 Sequence numbers 11

12 TCP functions - segmentation Advantages – Errors are less likely in smaller segments – Less retransmission if error is introduced in a segment – Easier for routers to hold segments in memory if onward route is busy Disadvantages 12

13 TCP functions - reliability TCP recovers from network damage to data Basic mechanism Datagrams may also get duplicated – Sequence numbers help identify these duplicates 13

14 Sequence numbers and reliability 14

15 TCP functions - reliability Datagrams may get seriously damaged during transmission – If datagrams are further fragmented by IP, some IP fragments may get lost during transmission – Such damage is corrected by adding a checksum to each datagram and comparing it at the receiver 15

16 TCP functions - multiplexing Modern computers are capable of multi- tasking TCP supports multiplexing by providing multiple port addresses within each host A network address and port address together is called a socket 16

17 Port addresses and multiplexing 17

18 TCP ports and airport gates 18

19 TCP port assignment On the sender side, the operating system assigns one of the free ports to an application that requires network connectivity How do you know what port to connect to on the receiver side? 19

20 Standard ports – Assigned by IANA: Internet Assigned Numbers Authority To see list – In Windows: C:/Windows/System32/drivers/etc/services – In UNIX/ Linux /etc/services Used ports displayed by netstat utility 20

21 Standard ports Typically ports 1 – 1023 are reserved for defined services – Applications may use the remaining port numbers 1024 – 65535 Common ports – 80 : web (http) – 25 : email (smtp) – 443: SSL (https) – 445: microsoft-ds (smb) 21

22 etc\services file 22

23 Viewing ports usage with netstat Ports on local desktopPorts on remote servers 23

24 Viewing ports usage with netstat Invoking applicationInvoked port 24

25 TCP functions – flow control If the receiver is slow, it will not be able to process the packets reaching it Therefore, TCP enables the receiver to limit the sender’s data rate If sender is slow, it only tests the patience of receivers 25

26 V. simple flow control mechanism 26

27 TCP functions – flow control Flow control mechanism shown earlier is called stop-and-wait – Sender waits for ACK before sending next datagram TCP flow control is accomplished by returning a “window” with every ACK “Window” indicates how many bytes of data the sender may transmit before receiving any more ACK 27

28 TCP flow control with window size 28

29 Sliding window Flow control is the regulation by the receiver of the amount of data the sender may send Creates a “sliding window” at the sender Packets that have received permission for transmission are within the window Window slides as receiver acknowledges packets or modifies window size 29

30 Sliding window 30

31 TCP functions – connection establishment Sequence numbers are core part of TCP It is not a good idea to reuse the same sequence numbers in succession Hence, before communication starts, sender and receiver negotiate a set of sequence numbers to use in TCP – Called 3-way handshake 31

32 Using an initial sequence number

33 3-way handshake 33

34 TCP Header 34

35 TCP header fields Port addresses have 16 bits – 2 16 possible ports – 2 16 = 65,536 ports possible per host – If computing resources are available, a single computer running TCP can support 65,536 simultaneous network connections Compare to telephone – no concept of port – only one network connection possible at a time 35

36 TCP header fields Sequence and acknowledgment numbers have 32 bits – Sequence number is the sequence number of the first data byte in the datagram – Acknowledgments are cumulative ACK 1079 implies that all data till byte number 1078 have been received correctly Initial sequence number for connection is chosen from an ascending clock 36

37 TCP header fields Data offset is the number of 32-bit words in the TCP header Control fields – ACK: 1 implies that the value of the acknowledgment field is meaningful – RST: Reset the connection – SYN: 1 implies that the segment is trying to synchronize sequence numbers – FIN: Sender has no more data to send 37

38 TCP header fields Window size – Number of data octets the sender of this information is willing to accept, beginning with the acknowledged segment Checksum – Verification of TCP header, IP header and TCP data 38

39 User Datagram Protocol (UDP) Defined in RFC 768 (1980) Many applications do not need TCP, e.g.. – When applications send very small amounts of data (DNS), – Prefer speed to reliability (voice) In these cases, if we can avoid TCP, we eliminate the overhead of keeping track of sequence numbers, window sizes etc. 39

40 UDP Header 40

41 Summary Why segmentation Why sequence numbers Why sliding window Why port numbers Why three-way handshake Why UDP

42 Case study – the financial industry Most financial transactions occur on computer networks – Securities markets, credit cards, bank transfers In securities markets, low latency is considered very important – The delays from TCP handshaking and flow control are unacceptable Alternate transport protocols are used

43 Hands-on exercise netstat In Windows – netstat /? Displays help – netstat –n – netstat –f – netstat –b Requires administrative privileges

44 Network design exercise Data rate from database transactions – Conversion from bytes to bits Data rate from phone calls


Download ppt "Chapter 5 Transport layer With special emphasis on Transmission Control Protocol (TCP)"

Similar presentations


Ads by Google