Netprog: TCP Details1 TCP Details Introduction to Networking Yan Gao TA Jan 27, 2005 Recital 3.

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

TCP - Part I Relates to Lab 5. First module on TCP which covers packet format, data transfer, and connection management.
CCNA – Network Fundamentals
Intermediate TCP/IP TCP Operation.
Transport Layer3-1 TCP. Transport Layer3-2 TCP: Overview RFCs: 793, 1122, 1323, 2018, 2581 r full duplex data: m bi-directional data flow in same connection.
CSEE W4140 Networking Laboratory Lecture 6: TCP and UDP Jong Yul Kim
UDP & TCP Where would we be without them!. UDP User Datagram Protocol.
1 Transport Layer Lecture 9 Imran Ahmed University of Management & Technology.
CS 471/571 Transport Layer 5 Slides from Kurose and Ross.
CSE551: Computer Network Review r Network Layers r TCP/UDP r IP.
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.
Networks I Transmission Control Protocol Instituto Tecnológico y de Estudios Superiores de Monterrey Campus Estado de México Prof. MSc. Ivan A. Escobar.
CS3505 The Internet and Info Hiway transport layer protocols : TCP/UDP.
BZUPAGES.COM 1 User Datagram Protocol - UDP RFC 768, Protocol 17 Provides unreliable, connectionless on top of IP Minimal overhead, high performance –No.
Chapter 7 – Transport Layer Protocols
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)
1 Transport Control Protocol. 2 Header Identifies the port number of a source application program. Used by the receiver to reply. (16-bit). Identifies.
CSCE 515: Computer Network Programming TCP Details Wenyuan Xu Department of Computer Science and Engineering.
Lecture 3 TCP/IP model CPE 401 / 601 Computer Network Systems slides are modified from Dave Hollinger.
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.
Netprog: TCP Details1 TCP Details Introduction to Networking.
CSEE W4140 Networking Laboratory Lecture 6: TCP and UDP Jong Yul Kim
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.
Gursharan Singh Tatla Transport Layer 16-May
Module A Panko and Panko Business Data Networks and Security, 9 th Edition © 2013 Pearson.
TRANSPORT LAYER T.Najah Al-Subaie Kingdom of Saudi Arabia Prince Norah bint Abdul Rahman University College of Computer Since and Information System NET331.
6.1. Transport Control Protocol (TCP) It is the most widely used transport protocol in the world. Provides reliable end to end connection between two hosts.
1 Netprog 2002 TCP/IP TCP/IP Transmission Control Protocol / Internet Protocol Based on Notes by D. Hollinger.
Lecture 6 Overview. TCP: Transmission Control Protocol TCP is an alternative transport layer protocol supported by TCP/IP. TCP provides: – Connection-oriented.
TCP : Transmission Control Protocol Computer Network System Sirak Kaewjamnong.
David Wetherall Professor of Computer Science & Engineering Introduction to Computer Networks Transport Layer Overview (§ )
Transport Layer: TCP and UDP. Overview of TCP/IP protocols Comparing TCP and UDP TCP connection: establishment, data transfer, and termination Allocation.
TCP1 Transmission Control Protocol (TCP). TCP2 Outline Transmission Control Protocol.
More on TCP Acknowledgements Sequence Number Field Initial Sequence Number Acknowledgement Number Field.
EECS340 Recitation 2: Very helpful to your project Hongyu Gao 1.
Slide #1 CIT 380: Securing Computer Systems TCP/IP.
© Jörg Liebeherr (modified by Malathi Veeraraghavan) 1 Overview Formats, Data Transfer, etc. Connection Management.
Hour 6 The Transport Layer 1. What You'll Learn in This Hour Connections oriented and connectionless protocols Ports and sockets TCP UDP 2.
4343 X2 – The Transport Layer Tanenbaum Ch.6.
11 CS716 Advanced Computer Networks By Dr. Amir Qayyum.
1 TCP ProtocolsLayer name DNSApplication TCP, UDPTransport IPInternet (Network ) WiFi, Ethernet Link (Physical)
3. END-TO-END PROTOCOLS (PART 1) Rocky K. C. Chang Department of Computing The Hong Kong Polytechnic University 22 March
Advanced Computer Networks
09-Transport Layer: TCP Transport Layer.
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)
Chapter 17 and 18: TCP is connection oriented
Process-to-Process Delivery
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.
Chapter 2 Transport Layer Protocols TCP UDP SCTP
CS4470 Computer Networking Protocols
TCP Details.
PART V Transport Layer.
PART 5 Transport Layer.
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
Introduction to Computer Networks
Lecture 21 and 22 5/29/2019.
Transport Protocols: TCP Segments, Flow control and Connection Setup
Process-to-Process Delivery: UDP, TCP
Transport Layer 9/22/2019.
Presentation transcript:

Netprog: TCP Details1 TCP Details Introduction to Networking Yan Gao TA Jan 27, 2005 Recital 3

Netprog: TCP Details2 The TCP Project Important Handouts: Minet –The Minet Technical ReportThe Minet Technical Report –The Minet Socket InterfaceThe Minet Socket Interface TCP Guides –RFC 793 (in convenient HTML format), RFC 1122RFC 793RFC 1122 –A very useful summary and picture of the TCP State diagramA very useful summary and picture of the TCP State diagram –TCP, UDP and IP pocket guide includes header detailsTCP, UDP and IP pocket guide –Brief overview of TCP contains a nice summary of the essentialsBrief overview of TCP –Here is a page with nice TCP animations. They explain TCP connection startup, termination, data flow and flow control and cumulative ack concepts. Please see animations 20_1 to 20_5.Here is a page with nice TCP animations

Netprog: TCP Details3 TCP Lingo When a client requests a connection, it sends a “SYN” segment (a special TCP segment) to the server port. SYN stands for synchronize. The SYN message includes the client’s ISN. ISN is Initial Sequence Number.

Netprog: TCP Details4 More... Every TCP segment includes a Sequence Number that refers to the first byte of data included in the segment. Every TCP segment includes a Request Number (Acknowledgement Number) that indicates the byte number of the next data that is expected to be received.

Netprog: TCP Details5 And more... There are a bunch of control flags: –URG: urgent data included. –ACK: this segment is (among other things) an acknowledgement. –RST: error - abort the session. –SYN: synchronize Sequence Numbers (setup) –FIN: polite connection termination.

Netprog: TCP Details6 And more... MSS: Maximum segment size (A TCP option) Window: Every ACK includes a Window field that tells the sender how many bytes it can send before the receiver will have to toss it away (due to fixed buffer size).

Netprog: TCP Details7 TCP Connection Creation A server accepts a connection. –Must be looking for new connections! A client requests a connection. –Must know where the server is!

Netprog: TCP Details8 Client Starts A client starts by sending a SYN segment with the following information: –Client’s ISN (generated pseudo-randomly) –Maximum Receive Window for client. –Optionally (but usually) MSS (largest datagram accepted). –No payload! (Only TCP headers)

Netprog: TCP Details9 Sever Response When a waiting server sees a new connection request, the server sends back a SYN segment with: –Server’s ISN (generated pseudo-randomly) –Request Number is Client ISN+1 –Maximum Receive Window for server. –Optionally (but usually) MSS –No payload! (Only TCP headers)

Netprog: TCP Details10 Finally When the Server’s SYN is received, the client sends back an ACK with: –Request Number is Server’s ISN+1

Netprog: TCP Details11 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

Netprog: TCP Details12 Why 3-Way? Why is the third message necessary? HINTS: –TCP is a reliable service. –IP delivers each TCP segment. –IP is not reliable.

Netprog: TCP Details13 TCP Data and ACK Once the connection is established, data can be sent. Each data segment includes a sequence number identifying the first byte in the segment. Each segment (data or empty) includes a request number indicating what data has been received.

Netprog: TCP Details14 Buffering Keep in mind that TCP is (usually) part of the Operating System. It takes care of all these details asynchronously. The TCP layer doesn’t know when the application will ask for any received data. TCP buffers incoming data so it’s ready when we ask for it.

Netprog: TCP Details15 TCP Buffers Both the client and server allocate buffers to hold incoming and outgoing data –The TCP layer does this. Both the client and server announce with every ACK how much buffer space remains (the Window field in a TCP segment).

Netprog: TCP Details16 Send Buffers The application gives the TCP layer some data to send. The data is put in a send buffer, where it stays until the data is ACK’d. –it has to stay, as it might need to be sent again! The TCP layer won’t accept data from the application unless (or until) there is buffer space.

Netprog: TCP Details17 ACKs A receiver doesn’t have to ACK every segment (it can ACK many segments with a single ACK segment). Each ACK can also contain outgoing data (piggybacking). If a sender doesn’t get an ACK after some time limit (MSL) it resends the data.

Netprog: TCP Details18 TCP Segment Order Most TCP implementations will accept out-of- order segments (if there is room in the buffer). Once the missing segments arrive, a single ACK can be sent for the whole thing. Remember: IP delivers TCP segments, and IP in not reliable - IP datagram can be lost or arrive out of order.

Netprog: TCP Details19 Termination 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.

Netprog: TCP Details20 FIN Either end of the connection can initiate termination. A FIN is sent, which means the application is done sending data. The FIN is ACK’d. The other end must now send a FIN. That FIN must be ACK’d.

Netprog: TCP Details21 App1 App2 FIN SN=X FIN SN=X 1 ACK=X+1 2 ACK=Y+1 4 FIN SN=Y FIN SN=Y 3...

Netprog: TCP Details22

Netprog: TCP Details23 Implementing TCP Interactive Data Flow DF_listen DF_SynRcvd DF_SynSent DF_Established DF_SendData DF_CloseWait DF_FinWait1 DF_Closing DF_LastAck DF_FinWait2 DF_TimeWait

Netprog: TCP Details24 Implementing TCP-Socket Layer interface SOCK_connect –Create an active connection –Add new connection to list –Return a STATUS with the same connection, no data, no byte count and the error codeReturn a STATUS with the same connection, no data, no byte count and the error code SOCK_accept –Perform the passive open –Return a STATUS with only the error code set SOCK_write –Push data into the connection’s output queue SOCK_forward –Forward matching packets –Message ignored, but Send back result code SOCK_close –Received a CLOSE request from Sock Layer –Remove the connection, and create a FIN packet SOCK_status –Status update –Byte count actually reflects the number of bytes read from the WRITE –Attempt to send the remaining bytes

Netprog: TCP Details25 Thank you !

Netprog: TCP Details26 Implementing TCP Interactive Data Flow DF_Listen{ if(IS_SYN(flags)) //Store remote side sequence number and connection information with a new connection, send SYN/ACK with my sequence number } DF_SynRcvd{ if(IS_ACK(flags)) //Send nothing and progress to ESTABLISHED state if valid ACK else if(IS_SYN(flags)) //Store remote side sequence number and connection information //with a new connection, send SYN/ACK with my sequence number. //If we get here, we recvd another syn before timing out. else if(IS_RST(flags)) //close the connection, return to listen state } Close

Netprog: TCP Details27 Samples //Send back result code SockRequestResponse repl; repl.type=STATUS; repl.connection=req.connection; repl.bytes=0; repl.error=EOK; MinetSend(sock,repl); Close