210 likes | 342 Views
CPET 355 Data Communications & Networking. 6. The Transport Layer (Transmission Control Protocol) Paul I-Hai Lin, Professor Electrical and Computer Engineering Technology Purdue University, Fort Wayne Campus. Transmission Control Protocol (TCP). Request For Comment Standard
E N D
CPET 355Data Communications & Networking 6. The Transport Layer (Transmission Control Protocol) Paul I-Hai Lin, Professor Electrical and Computer Engineering Technology Purdue University, Fort Wayne Campus Prof. Paul Lin
Transmission Control Protocol (TCP) • Request For Comment Standard • RFC 793 – original • RFC 1122 – revised • RFC 1323 – extension • Connection-oriented service • Accepts user data stream from local process (running program) • Break the up into pieces (< 64 KB, often 1460 bytes) as IP datagram • Using specific port Prof. Paul Lin
Transmission Control Protocol (TCP) • TCP/IP Connections • Full-duplex • Point-to-point • TCP/IP Suites • FTP – file transfer (control port 21, data port 20) • Telnet – remote login terminal service (port 23) • SMTP – E-mail (port 25) • HTTP – HyperText Transfer Protocol (port 80) Prof. Paul Lin
Transmission Control Protocol (TCP) • Transport layer duties: • End-to-end delivery (treat individual packets independently) • Addressing (many-to-many entities called service points) • Reliable delivery (error control, sequence control, loss control, and duplication control) • Flow control • Multiplexing Prof. Paul Lin
The TCP Header From Figure 6-29, Page 537, Computer Networks, 4th Ed, Andrew Tanenbaum, Prentice Hall Prof. Paul Lin
The TCP Segment Header • Max Data Bytes • 20-byte header • 65,495 bytes data = 65535 – 20 bytes (TCP header) – 20 bytes (IP header) Prof. Paul Lin
The TCP Segment Header • Source Port (16-bit) • Destination Port (16-bit) • Sequence Number (32-bit) - specify the sequence position of first data byte in the segment • Ack Number (32-bit) - specify the next sequence number expected by the sender of the segment • TCP Header Length (4-bit) Prof. Paul Lin
The TCP Segment Header(continue) • Reserved (6-bit) • 6 Flags • URG – urgent pointer • ACK – ack is valid or not • PSH – push data for efficiency • RST – reset connection, reject, refuse • SYN – establish connection • FIN – release connection Prof. Paul Lin
TCP Segment Format (continue) • Window Size (16-bit): Buffer space allocated for the connection • Checksum (16-bit): On header and data • Urgent Pointer (16-bit): Points to the end of data in the data field that is considered as urgent and required immediate attention • Options: Variable length, Maximum Segment Size (MMS) could be sent • Padding: Padding on a 32-bit boundary, so that the data offset may correctly pointto it Prof. Paul Lin
The Main Functions of TCP • Session establishment • Byte stream communications • Sliding windows Prof. Paul Lin
The Main Functions of TCPSession Establishment • A TCP Three-way Handshake HOST1SYN. Data HOST2 ACK, SYN. Data ACK Prof. Paul Lin
TCP Byte Stream Communications • Segment sequence number of the first byte in the data field • ACK number for each segment • When TCP sends a segment, it retains a copy of the segment in a queue (transmit window) until an ACK is received • Segments not acknowledged are retransmitted Prof. Paul Lin
TCP Sliding Windows • A Sliding Window = buffer • The size of sliding window can be adjusted • Segments sent may take different routes due to failed or busy links • Data must be buffered on the sending host until remote host has acknowledged it Prof. Paul Lin
TCP/IP Troubleshooting Utilities • Ping (Packet Internet Groper) command • The ping command is design for troubleshooting and tracking a single-point hardware or software failure in the Internet. • Verifies whether a remote host can be reached • Shows statistic about packet loss and delivery time. Prof. Paul Lin
TCP/IP Utilities and Troubleshooting • Ping (Packet Internet Groper) • When called, the ping command sends one datagram per second • Listens for ECHO_RESPONSE returned • Sends 4 transmissions of 32-byte each to verify the network connection by default • Similar to the function of ICMP (Internet Control Messaging Protocol) on the IP layer Prof. Paul Lin
Using Ping – A Linux Example [plin@LinMysql plin]$ ping 149.164.36.5 PING 149.164.36.5 (149.164.36.5) from 149.164.36.5 : 56(84) bytes of data. 64 bytes from 149.164.36.5: icmp_seq=1 ttl=64 time=0.214 ms 64 bytes from 149.164.36.5: icmp_seq=2 ttl=64 time=0.059 ms 64 bytes from 149.164.36.5: icmp_seq=3 ttl=64 time=0.050 ms 64 bytes from 149.164.36.5: icmp_seq=4 ttl=64 time=0.055 ms Prof. Paul Lin
Using Ping – Another Linux Example [plin@LinMysql plin]$ ping -c 10 www.iu.edu PING www.iu.edu (129.79.78.4) from 149.164.36.129 : 56(84) bytes of data. 64 bytes from lux.ucs.indiana.edu (129.79.78.4): icmp_seq=1 ttl=57 time=13.1 ms 64 bytes from lux.ucs.indiana.edu (129.79.78.4): icmp_seq=2 ttl=57 time=12.6 ms 64 bytes from lux.ucs.indiana.edu (129.79.78.4): icmp_seq=3 ttl=57 time=9.65 ms 64 bytes from lux.ucs.indiana.edu (129.79.78.4): icmp_seq=4 ttl=57 time=9.91 ms 64 bytes from lux.ucs.indiana.edu (129.79.78.4): icmp_seq=5 ttl=57 time=9.90 ms Prof. Paul Lin
Using Ping – A MS Windows Example C:\>ping 149.164.36.5 Pinging 149.164.36.5 with 32 bytes of data: Reply from 149.164.36.5: bytes=32 time<10ms TTL=63 Reply from 149.164.36.5: bytes=32 time<10ms TTL=63 Reply from 149.164.36.5: bytes=32 time<10ms TTL=63 Reply from 149.164.36.5: bytes=32 time<10ms TTL=63 Ping statistics for 149.164.36.5: Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), Approximate round trip times in milli-seconds: Minimum = 0ms, Maximum = 0ms, Average = 0ms Prof. Paul Lin
Using Ping – A MS Windows Example Ping Command C:\>ping /? Usage: ping [-t] [-a] [-n count] [-l size] [-f] [-i TTL] [-v TOS] [-r count] [-s count] [[-j host-list] | [-k host-list]] [-w timeout] destination-list Options: -t Ping the specified host until stopped. To see statistics and continue - type Control-Break; To stop - type Control-C. -a Resolve addresses to hostnames. Prof. Paul Lin
Using Ping – A MS Windows Example (continue) Options: -n count Number of echo requests to send. -l size Send buffer size. -f Set Don't Fragment flag in packet. -i TTL Time To Live. Prof. Paul Lin
Using Ping – A MS Windows Example (continue) Options: -v TOS Type Of Service. -r count Record route for count hops. -s count Timestamp for count hops. -j host-list Loose source route along host-list. -k host-list Strict source route along host-list. -w timeout Timeout in milliseconds to wait for each reply. Prof. Paul Lin