TCP Tutorial Internet Computing KUT (http://icl.kut.ac.kr)http://icl.kut.ac.kr Youn-Hee Han It is licensed under a Creative Commons Attribution.

Slides:



Advertisements
Similar presentations
Transportation Layer (2). TCP full duplex data: – bi-directional data flow in same connection – MSS: maximum segment size connection-oriented: – handshaking.
Advertisements

Introduction to TCP A first look at the sockets API for ‘connection-oriented’ client/server application programs.
TCP - Part I Relates to Lab 5. First module on TCP which covers packet format, data transfer, and connection management.
Fundamentals of Computer Networks ECE 478/578 Lecture #20: Transmission Control Protocol Instructor: Loukas Lazos Dept of Electrical and Computer Engineering.
CSEE W4140 Networking Laboratory Lecture 6: TCP and UDP Jong Yul Kim
UDP & TCP Where would we be without them!. UDP User Datagram Protocol.
CS 471/571 Transport Layer 5 Slides from Kurose and Ross.
TCP & UDP - Protocol Details Yen-Cheng Chen
1 TCP - Part I Relates to Lab 5. First module on TCP which covers packet format, data transfer, and connection management.
1 CS 4396 Computer Networks Lab Transmission Control Protocol (TCP) Part I.
TCP: Transmission Control Protocol Overview Connection set-up and termination Interactive Bulk transfer Timers Improvements.
8. Transport Protocol and UDP 8.1 Transport protocol : End-to-end protocol –IP: Host to host packet delivery –Transport: Process to process communication.
Transmission Control Protocol (TCP) Basics
CS3505 The Internet and Info Hiway transport layer protocols : TCP/UDP.
Transport Layer – TCP (Part1) Dr. Sanjay P. Ahuja, Ph.D. Fidelity National Financial Distinguished Professor of CIS School of Computing, UNF.
Computer Networks 2 Lecture 2 TCP – I - Transport Protocols: TCP Segments, Flow control and Connection Setup.
Netprog: TCP Details1 TCP Details. Netprog: TCP Details2 TCP Lingo When a client requests a connection, it sends a “SYN” segment (a special TCP segment)
CSCE 515: Computer Network Programming TCP Details Wenyuan Xu Department of Computer Science and Engineering.
TCP© Dr. Ayman Abdel-Hamid, CS4254 Spring CS4254 Computer Network Architecture and Programming Dr. Ayman A. Abdel-Hamid Computer Science Department.
EEC-484/584 Computer Networks Lecture 15 Wenbing Zhao (Part of the slides are based on Drs. Kurose & Ross ’ s slides for their Computer.
Netprog: TCP Details1 TCP Details Introduction to Networking John Otto TA Jan 31, 2007 Recital 4.
EEC-484/584 Computer Networks Lecture 7 Wenbing Zhao (Part of the slides are based on Drs. Kurose & Ross ’ s slides for their Computer.
Netprog: TCP Details1 TCP Details Introduction to Networking.
CSE 461: Transport Layer Connections. Naming Processes/Services  Process here is an abstract term for your Web browser (HTTP), servers (SMTP),
CSEE W4140 Networking Laboratory Lecture 6: TCP and UDP Jong Yul Kim
Lecture 23: Network Primer 7/15/2003 CSCE 590 Summer 2003.
CSCE 515: Computer Network Programming TCP Details Wenyuan Xu Department of Computer Science and Engineering.
EEC-484/584 Computer Networks Lecture 13 Wenbing Zhao (Part of the slides are based on Drs. Kurose & Ross ’ s slides for their Computer.
CSCE 515: Computer Network Programming Chin-Tser Huang University of South Carolina.
1 Ch. 7 : Internet Transport Protocols. Transport Layer Our goals: r understand principles behind transport layer services: m Multiplexing / demultiplexing.
TCP. Learning objectives Reliable Transport in TCP TCP flow and Congestion Control.
1 ELEN 602 Lecture 15 More on IP TCP. 2 byte stream Send buffer segments Receive buffer byte stream Application ACKs Transmitter Receiver TCP Streams.
Transport Layer TCP and UDP IS250 Spring 2010
EEC-484/584 Computer Networks Lecture 13 Wenbing Zhao (Part of the slides are based on Drs. Kurose & Ross ’ s slides for their Computer.
Gursharan Singh Tatla Transport Layer 16-May
TRANSPORT LAYER T.Najah Al-Subaie Kingdom of Saudi Arabia Prince Norah bint Abdul Rahman University College of Computer Since and Information System NET331.
Transport Layer 3-1 Chapter 3 Transport Layer Computer Networking: A Top Down Approach 6 th edition Jim Kurose, Keith Ross Addison-Wesley March 2012 All.
TCP Transport Control Protocol Information management 2 Groep T Leuven – Information department 2/35 Introduction UDP provides the connection.
TCP : Transmission Control Protocol Computer Network System Sirak Kaewjamnong.
TCP1 Transmission Control Protocol (TCP). TCP2 Outline Transmission Control Protocol.
Transport Layer3-1 Chapter 3: Transport Layer Our goals: r understand principles behind transport layer services: m multiplexing/demultipl exing m reliable.
1 Introduction to Computer Networks University of ilam Dr. Mozafar Bag-Mohammadi Transport Layer.
Connection Establishment and Termination. Tcpdump tcpdump is a common packet analyzer that runs under the command line. It allows the user to intercept.
© Jörg Liebeherr (modified by Malathi Veeraraghavan) 1 Overview Formats, Data Transfer, etc. Connection Management.
Ilam University Dr. Mozafar Bag-Mohammadi 1 Transport Layer.
11 CS716 Advanced Computer Networks By Dr. Amir Qayyum.
1 Transmission Control Protocol (TCP) RFC: Introduction The TCP is intended to provide a reliable process-to-process communication service in a.
Two Transport Protocols Available Transmission Control Protocol (TCP) User Datagram Protocol (UDP) Provides unreliable transfer Requires minimal – Overhead.
3. END-TO-END PROTOCOLS (PART 1) Rocky K. C. Chang Department of Computing The Hong Kong Polytechnic University 22 March
Advanced Computer Networks
Fast Retransmit For sliding windows flow control we waited for a timer to expire before beginning retransmission of a packet TCP uses an additional mechanism.
TCP - Part I Relates to Lab 5. First module on TCP which covers packet format, data transfer, and connection management.
Introduction to Networks
Introduction to Networking Recital 4
5. End-to-end protocols (part 1)
TCP.
TCP - Part I Karim El Defrawy
TCP - Part I Relates to Lab 5. First module on TCP which covers packet format, data transfer, and connection management.
TCP Details.
Ilam University Dr. Mozafar Bag-Mohammadi
Chapter 5 Transport Layer Introduction
TCP - Part I Relates to Lab 5. First module on TCP which covers packet format, data transfer, and connection management.
Transport Protocols: TCP Segments, Flow control and Connection Setup
Chapter 5 Transport Layer Introduction
Introduction to Computer Networks
Introduction to Computer Networks
Introduction to Computer Networks
Lecture 21 and 22 5/29/2019.
Transport Protocols: TCP Segments, Flow control and Connection Setup
Transport Layer 9/22/2019.
Presentation transcript:

TCP Tutorial Internet Computing KUT ( Youn-Hee Han It is licensed under a Creative Commons Attribution 2.5 License

Computer Network2 TCP Introduction

Computer Network3 Connection-oriented Service with Reliability Information unit is a “segment” 응용 데이터는 TCP 가 전송하기 적합한 크기로 나뉨 반면, UDP 는 각 응용에 맞는 UDP 데이터그램을 직접 생성 Byte stream service Two application exchanges 8-bit (byte) stream date TCP does not interpreter the bytes’ contents No Message Boundary TCP Features

Computer Network4 Sender TCP set a timer whenever sending a segment Sender waits an ACK message after sending a segment Receiver TCP should send an ACK message to the sender Sender re-sends the segment if it does not receive an ACK message before the timer expires TCP Features

Computer Network5 TCP segment is delivered as IP datagram IP datagram may be out of order  TCP segment may be out of order Receiver TCP re-organizes the segments according to the correct sequence Receive TCP eliminates the duplicated segment TCP Features

Computer Network6 TCP provides flow control TCP 연결의 각 종단은 유한한 버퍼를 가짐 수신측 TCP 는 버퍼용량을 초과하지 않는 범위의 데이터를 받음 TCP provides congestion control 네트워크가 Congestion 하여 Ack 가 늦게 오거나 Ack 가 오지 않는 경우 보내는 데이터의 양을 줄임 TCP utilizes the checksum to detect an error on the header and data 데이터가 전송 중에 변화되었는지 검출하는 것이 목적 기본적으로 오류가 난 세그먼트는 받지 않은 것으로 취급.  송신자의 타임아웃과 재전송을 기다림. IP provides 16 bit checksum for IP header. TCP provides 32 bit checksum for TCP header and TCP data. TCP Features

Computer Network7 Full-duplex communication Bi-directional data flow Data can be transmitted while receiving Use of "Piggyback"  Data packets can convey feedback information in the opposite direction TCP Features

Computer Network8 TCP may delay data transfer. If TCP has not received enough data from the application  TCP tries to aggregate data as much as possible. Applications that use TCP do not know when data will be sent. TCP Features

Computer Network9 TCP Ports, Connections, And Endpoints Endpoint of communication is application program TCP uses protocol port number to identify application TCP defines an “ endpoint ” to be a pair of integers (host, port)  Where host is the IP address for a host TCP connection between two endpoints identified by four items Sender ’ s IP address Sender ’ s protocol port number Receiver ’ s IP address Receiver ’ s protocol port number

Computer Network10 Socket: a door between application process and end- end-transport protocol (UCP or TCP) process TCP with buffers, variables socket controlled by application developer controlled by operating system host or server process TCP with buffers, variables socket controlled by application developer controlled by operating system host or server internet Socket

Computer Network11 TCP Segment Header 20 bytes + options One of options: Maximum Segment Size (MSS) 16-bit destination port number16-bit source port number 32-bit sequence number 32-bit acknowledgment number 4-bit header length reserved (6bits) URGURG ACKACK PSHPSH RSTRST SYNSYN FINFIN 16-bit window sizes 16-bit urgent pointer16-bit TCP checksum options (if any) data (if any) Counting by bytes of data (not segments!)

Computer Network12 Each connection identified with 4-tuple: (SrcPort, SrcIPAddr, DsrPort, DstIPAddr) Sliding window + flow control acknowledgment(Num), SequenceNum, AdvertisedWindow Flags SYN, FIN, RESET, PUSH, URG, ACK Checksum pseudo header + TCP header + data TCP Segment Header

Computer Network13 Six flags and Option Six flag bits URG - The urgent pointer is valid. (generally not used) ACK - The acknowledgment number is valid PSH - The receiver pass this data to the application as soon as possible. (generally not used) RST - Reset the connection. SYN - Synchronize sequence numbers to initiate a connection. FIN - The sender is finished sending data. Urgent pointer URG 플래그가 설정되어 있을 때만 유효함. 송신 측이 상대 편에게 긴급한 데이터를 보내는 방법 (out-of-band data) Option field MSS 라고 불리는 maximum segment size option 을 위한 자리 Connection establish (SYN 이 set 됨 ) 하기 위한 메시지에 이 option 을 지정함

Computer Network14 Client Server SYN ISN=X SYN ISN=X 1 SYN ISN=Y ACK=X+1 SYN ISN=Y ACK=X+1 2 ACK=Y+1 3 time TCP connection establishment 3 way handshake Client: “I want to talk, and I’m starting with byte number X”. Server: “OK, I’m here and I’ll talk. My first byte will be called number Y, and I know your first byte will be number X+1”. Client: “Got it - you start at byte number Y+1”.

Computer Network15 TCP connection establishment 3 way handshake Initial sequence numbers, x & y, are chosen randomly Guarantees both sides ready & know it, and sets initial sequence numbers, also sets window & mss Once connection established, data can flow in both directions, equally well, there is no master or slave Send SYN seq. #=x Rcv SYN + ACK segt Send ACK seq.#=y+1 Rcv SYN segment Rcv ACK segment Send SYN seq.#=y, ACK #=x+1 Site 1 Site 2 Active Win 4096, mss 1460 Passive Win 4096, mss 1024

Computer Network16 TCP connection establishment Passive And Active Opens Two sides of a connection  Client  Server One side initiates contact A client program (Site 1) Uses TCP ’ s active open One side waits for contact A server program (Site 2) Uses TCP ’ s passive open

Computer Network17 TCP close connection The TCP layer can send a RST segment that terminates a connection if something is wrong. Usually the application tells TCP to terminate the connection politely with a FIN segment. FIN segment Either end of the connection can initiate termination. Application 1 call “ close() ” function A FIN is sent, which means the application is done sending data. The FIN is ACK ’ d. Application 2 call “ close() ” function A FIN is also sent. That FIN must be ACK ’ d.

Computer Network18 TCP close connection Modified 3 way handshake (or 4 way termination) App1 App2 FIN SN=X FIN SN=X 1 ACK=X+1 2 ACK=Y+1 4 FIN SN=Y FIN SN=Y App1: “I have no more data for you”. App2: “OK, I understand you are done sending.” ……. pause… App2: “OK - Now I’m also done sending data”. App1: “I understand, Goodbye”

Computer Network19 TCP close connection Modified 3 way handshake (or 4 way termination) App tells TCP to close, TCP sends remaining data & waits for ACK, then sends FIN & EOF (End of Data) Site 2 TCP ACKs FIN, tells its application “ EOF ” Site 2 sends FIN when its app closes connection (may be long delay) exit(0) automatically calls close() (App closes) Send FIN seq=s Rcv ACK segment Rcv FIN segment Receive ACK segment Send ACK s+1 (inform app) Site 1 Site 2 Rcv FIN + ACK seg Send ACK t+1 (app closes connection) Send FIN seq=t, ACK s+1 FIN (EOF) Timed wait

Computer Network20 State Transition Diagram ESTABLISHED state to the CLOSED 1.This side closes first: ESTABLISHED >> FIN_WAIT_1 >> FIN_WAIT_2 >> TIMEWAIT >> CLOSED 2.The other side closes first: ESTABLISHED >> CLOSE_WAIT >> LAST_ACK >> CLOSED 3.Both sides close at the same time: ESTABLISHED >> FIN_WAIT_1 >> CLOSINC >> TIME_WAIT >> CLOSED.