1 / 41

Net-Centric Computing Division Department of Computer Science Bogor Agricultural University

Net-Centric Computing Division Department of Computer Science Bogor Agricultural University. KOM 312 Komunikasi Data dan Jaringan Komputer. Transport Protocol. Sri Wahjuni my_juni04(at)ipb.ac.id. agenda. Transport Layer Services UDP TCP. Transport vs. network layer.

jemima
Download Presentation

Net-Centric Computing Division Department of Computer Science Bogor Agricultural University

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. Net-Centric Computing Division Department of Computer Science Bogor Agricultural University KOM 312 Komunikasi Data danJaringanKomputer Transport Protocol Sri Wahjuni my_juni04(at)ipb.ac.id

  2. agenda • Transport Layer Services • UDP • TCP swj/12

  3. Transport vs. network layer • network layer: logical communication between hosts • transport layer: logical communication between processes • relies on, enhances, network layer services swj/12

  4. agenda • Transport Layer Services • UDP • UDP Datagram • UDP Multiplexing • UDP Checksum • TCP swj/12

  5. Unreliable service, UDP segments may be: lost delivered out of order to application connectionless: no handshaking between UDP sender, receiver each UDP segment handled independently of others Applications multimedia (e.g., RTP) network services (e.g., DNS, RIP, SNMP) Why is there a UDP? no connection establishment (which can add delay) simple: no connection state at sender, receiver small segment header no congestion control: UDP can blast away as fast as desired UDP: User Datagram Protocol [RFC 768] swj/12

  6. Format Datagram UDP swj/12

  7. Create sockets with port numbers: DatagramSocket mySocket1 = new DatagramSocket(99111); DatagramSocket mySocket2 = new DatagramSocket(99222); UDP socket identified by two-tuple: (dest IP address, dest port number) When host receives UDP segment: checks destination port number in segment directs UDP segment to socket with that port number IP datagrams destined to the same port number directed to same process UDP multiplexing swj/12

  8. P2 P1 P1 P3 SP: 9157 client IP: A DP: 6428 Client IP:B server IP: C SP: 6428 SP: 6428 SP: 5775 DP: 6428 DP: 9157 DP: 5775 UDP Multiplexing (cont) DatagramSocket serverSocket = new DatagramSocket(6428); swj/12 SP provides “return address”

  9. Sender: treat segment contents as sequence of 16-bit integers checksum: addition (1’s complement sum) of segment contents sender puts checksum value into UDP checksum field Receiver: compute checksum of received segment check if computed checksum equals checksum field value: NO - error detected YES - no error detected. UDP checksum Goal: detect “errors” (e.g., flipped bits) in transmitted segment swj/12

  10. Pseudoheader ditambahkan pada Datagram UDP swj/12

  11. UDP length =IP length - IP header’s length swj/12

  12. Figure 11-9 Kalkulasi Checksum pada Datagram UDP Sederhana swj/12

  13. agenda • Transport Layer Services • UDP • TCP • TCP Segment • TCP Multiplexing • TCP Connection Management • TCP Congestion Control swj/12

  14. connection-oriented: handshaking (exchange of control msgs) init’s sender, receiver state before data exchange flow controlled: sender will not overwhelm receiver applications use TCP : HTTP, SMTP, FTP, TELNET, POP3 point-to-point: one sender, one receiver reliable, in-order byte stream: no “message boundaries” pipelined:  sliding window TCP congestion and flow control set window size send & receive buffers TCP: Overview RFCs: 793, 1122, 1323, 2018, 2581 swj/12

  15. TCP segment structure swj/12

  16. Maximum Segment Size (MSS) • Maximum Segment Size • largest block of data that TCP sends to other end • Each end can announce its MSS during connection establishment • Default is 576 bytes including 20 bytes for IP header and 20 bytes for TCP header • Ethernet implies MSS of 1460 bytes swj/12

  17. TCP socket identified by 4-tuple: source IP address source port number dest IP address dest port number recv host uses all four values to direct segment to appropriate socket Server host may support many simultaneous TCP sockets: each socket identified by its own 4-tuple Web servers have different sockets for each connecting client non-persistent HTTP will have different socket for each request TCP Multiplexing swj/12

  18. SP: 5775 SP: 9157 P1 P1 P2 P4 P3 P6 P5 client IP: A DP: 80 DP: 80 Connection-oriented demux (cont) S-IP: B swj/12 D-IP:C SP: 9157 DP: 80 Client IP:B server IP: C S-IP: A S-IP: B D-IP:C D-IP:C

  19. TCP checksum Two mechanism: 1. If the length of the segment is not a multiple of 16 bits  add 0’s 2. add pseudoheader at the beginning of the segment TCP pseudoheader swj/12

  20. Seq. #’s: byte stream “number” of first byte in segment’s data ACKs: seq # of next byte expected from other side cumulative ACK time TCP seq. #’s and ACKs Host B Host A User types ‘C’ Seq=42, ACK=79, data = ‘C’ host ACKs receipt of ‘C’, echoes back ‘C’ Seq=79, ACK=43, data = ‘C’ swj/12 host ACKs receipt of echoed ‘C’ Seq=43, ACK=80 simple telnet scenario

  21. agenda • Transport Layer Services • UDP • TCP • TCP Segment • TCP Connection Management • TCP Congestion Control swj/12

  22. TCP connection management • Connection establishment : • Three-way handshaking • Data transfer : • TCP flow control • Connection termination: swj/12

  23. TCP Connection establishment Three way handshake: Step 1:client host sends TCP SYN segment to server • specifies initial seq # • no data Step 2:server host receives SYN, replies with SYNACK segment • server allocates buffers • specifies server initial seq. # Step 3: client receives SYNACK, replies with ACK segment, which may contain data swj/12

  24. TCP Flow Control • Buffer limitations & speed mismatch can result in loss of data that arrives at destination • Receiver controls rate at which sender transmits to prevent buffer overflow (using advertised window) • Sliding window protocol (selective repeat ARQ) uses for end-to-end flow control swj/12 Application buffer used Transport segments buffer buffer available = B advertised window size < B

  25. receive side of TCP connection has a receive buffer: speed-matching service: matching the send rate to the receiving app’s drain rate flow control sender won’t overflow receiver’s buffer by transmitting too much, too fast TCP Flow control: how it works swj/12 • app process may be slow at reading from buffer

  26. (Suppose TCP receiver discards out-of-order segments) spare room in buffer = RcvWindow = RcvBuffer-[LastByteRcvd - LastByteRead] Rcvr advertises spare room by including value of RcvWindow in segments LastByteRcvd – LastByteRead ≤ RcvBuffer Sender limits unACKed data to RcvWindow guarantees receive buffer doesn’t overflow TCP Flow control: how it works swj/12

  27. Window advertised swj/12

  28. Closing a connection: client closes socket:clientSocket.close(); Step 1:client end system sends TCP FIN control segment to server Step 2:server receives FIN, replies with ACK. Closes connection, sends FIN. client server close FIN ACK close FIN ACK timed wait closed TCP Connection termination swj/12

  29. Step 3:client receives FIN, replies with ACK. Enters “timed wait” - will respond with ACK to received FINs Step 4:server, receives ACK. Connection closed. TCP Connection termination (cont.) client server closing FIN ACK closing FIN swj/12 ACK timed wait closed closed

  30. Connection establishment Example of tcp segment Connection termination swj/12

  31. agenda • Transport Layer Services • Multiplexing/Demultiplexing • UDP • UDP Datagram • TCP • TCP Segment • TCP Connection Management • TCP Congestion Control swj/12

  32. TCP Congestion Control (a) A fast network feeding a low capacity receiver. (b) A slow network feeding a high-capacity receiver. swj/12

  33. TCP Congestion Control (cont.) • Available bandwidth to destination varies with activity of other users • Transmitter dynamically adjusts transmission rate according to network congestion as indicated by RTT (round trip time) & ACKs • Elastic utilization of network bandwidth • Uses congestion window to specify the maximum number of bytes that a TCP sender is allowed to transmit swj/12

  34. sender limits transmission: LastByteSent-LastByteAcked  CongWin Specifically : LastByteSent-LastByteAcked  min{CongWin,RcvWindow} Roughly, RTT ~tRTT (new) = *tRTT (old) + (1-)*n with  = 0.875 and n is time that elapses from the measured segment is transmitted until when the corresponding acknowledge is received CongWin rate = Bytes/sec RTT TCP Congestion Control swj/12

  35. TCP Congestion Control (2) CongWin is dynamic, function of perceived network congestion How does sender perceive congestion? • loss event = timeoutor3 duplicate acks • TCP sender reduces rate (CongWin) after loss event • Timeout = tRTT + 4*dRTT dRTT (new) = ()*dRTT (old) + (1-)*|n – tRTT | with  = 0.75 TCP three phases: • Slow start • Congestion avoidance • Recovery after congestion swj/12

  36. When connection begins, CongWin = 1 MSS Example: MSS = 500 bytes & RTT = 200 msec initial rate = 20 kbps available bandwidth may be >> MSS/RTT desirable to quickly ramp up to respectable rate Slow Start Phase swj/12

  37. When connection begins, increase rate exponentially until first loss event: double CongWin every RTT done by incrementing CongWin for every ACK received Summary: initial rate is slow but ramps up exponentially fast time Slow Start Phase (2) Host A Host B one segment RTT two segments swj/12 four segments

  38. Congestion Avoidance • When congestion window reaches/exceeds a congestion threshold value, the algorithm increases the congestion window by one segment for each RTT (linearly increasing) swj/12

  39. After 3 dup ACKs: CongWin is cut in half window then grows linearly But after timeout event: CongWin instead set to 1 MSS window then grows exponentially to a threshold, then grows linearly Recovery from congestion Philosophy: • 3 dup ACKs indicates network capable of delivering some segments • timeout before 3 dup ACKs is “more alarming” swj/12

  40. Define Variable Threshold (usually 65KB) At the beginning sender enters slow start phase When CongWin hits Threshold, sender enters congestion avoidance phase (CongWin increases linearly) At loss event, Threshold is set to 1/2 of CongWin just before loss event IF congestion is caused by tripple duplicate ACK: CongWin = Threshold enter congestion avoidance phase Else CongWin = 1 MSS enter slow start phase example swj/12

  41. references • Garcia A.L., Widjaja A. 2004. Networks Communication.: Fundamental Concepts and Key Architectures 2nd ed. – Chapter 8. McGraw-Hill Companies, Inc. • Kurose J.F., Ross K.W. 2003. Computer Networking : A Top-Down Approach Featuring Internet 2nd ed. – Chapter 4. Pearson Education. • Sukoco H. 08crc_kom334.ppt swj/12

More Related