April 5, 2004 April 5, 2004 Prof. Paul Lin Prof. Paul Lin 1 CPET 355 CPET 355 Data Communications & Data Communications & Networking Networking 6. The Transport Layer 6. The Transport Layer (Transmission Control Protocol) (Transmission Control Protocol) Paul I-Hai Lin, Professor Paul I-Hai Lin, Professor Electrical and Computer Engineering Technology Electrical and Computer Engineering Technology Purdue University, Fort Wayne Campus Purdue University, Fort Wayne Campus
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 - PowerPoint PPT Presentation
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
April 5, 2004April 5, 2004 Prof. Paul LinProf. Paul Lin 11
CPET 355CPET 355
Data Communications & NetworkingData Communications & Networking
6. The Transport Layer6. The Transport Layer(Transmission Control Protocol)(Transmission Control Protocol)
Paul I-Hai Lin, Professor Paul I-Hai Lin, Professor Electrical and Computer Engineering TechnologyElectrical and Computer Engineering Technology
Purdue University, Fort Wayne CampusPurdue University, Fort Wayne Campus
April 5, 2004April 5, 2004 Prof. Paul LinProf. Paul Lin 22
Transmission Control Protocol Transmission Control Protocol (TCP)(TCP)
April 5, 2004April 5, 2004 Prof. Paul LinProf. Paul Lin 77
The TCP Segment HeaderThe TCP Segment Header
Source Port (16-bit)Source Port (16-bit) Destination Port (16-bit)Destination Port (16-bit) Sequence Number (32-bit) - Sequence Number (32-bit) - specify specify
the sequence position of first data byte in the sequence position of first data byte in the segmentthe segment
Ack Number (32-bit) - Ack Number (32-bit) - specify the next specify the next sequence number expected by the sender sequence number expected by the sender of the segmentof the segment
April 5, 2004April 5, 2004 Prof. Paul LinProf. Paul Lin 88
The TCP Segment HeaderThe TCP Segment Header(continue)(continue)
Reserved (6-bit)Reserved (6-bit) 6 Flags6 Flags
• URG – urgent pointerURG – urgent pointer• ACK – ack is valid or notACK – ack is valid or not• PSH – push data for efficiencyPSH – push data for efficiency• RST – reset connection, reject, refuseRST – reset connection, reject, refuse• SYN – establish connectionSYN – establish connection• FIN – release connectionFIN – release connection
April 5, 2004April 5, 2004 Prof. Paul LinProf. Paul Lin 99
TCP Segment Format TCP Segment Format (continue)(continue)
Window Size (16-bit): Buffer space allocated for the Window Size (16-bit): Buffer space allocated for the connectionconnection
Checksum (16-bit): On header and dataChecksum (16-bit): On header and data Urgent Pointer (16-bit): Points to the end of data in the Urgent Pointer (16-bit): Points to the end of data in the
data field that is considered as urgent and required data field that is considered as urgent and required immediate attentionimmediate attention
Options: Variable length, Maximum Segment Size Options: Variable length, Maximum Segment Size (MMS) could be sent(MMS) could be sent
Padding: Padding on a 32-bit boundary, so that the data Padding: Padding on a 32-bit boundary, so that the data
offset may correctly pointoffset may correctly point to itto it
April 5, 2004April 5, 2004 Prof. Paul LinProf. Paul Lin 1010
The Main Functions of TCPThe Main Functions of TCP
Segment sequence number of the first Segment sequence number of the first byte in the data fieldbyte in the data field
ACK number for each segmentACK number for each segment When TCP sends a segment, it retains a When TCP sends a segment, it retains a
copy of the segment in a queue (transmit copy of the segment in a queue (transmit window) until an ACK is receivedwindow) until an ACK is received
Segments not acknowledged are Segments not acknowledged are retransmittedretransmitted
April 5, 2004April 5, 2004 Prof. Paul LinProf. Paul Lin 1313
TCP Sliding WindowsTCP Sliding Windows
A Sliding Window = bufferA Sliding Window = buffer The size of sliding window can be adjustedThe size of sliding window can be adjusted Segments sent may take different routes Segments sent may take different routes
due to failed or busy linksdue to failed or busy links Data must be buffered on the sending host Data must be buffered on the sending host
until remote host has acknowledged ituntil remote host has acknowledged it
April 5, 2004April 5, 2004 Prof. Paul LinProf. Paul Lin 1414
Ping (Packet Internet Groper) commandPing (Packet Internet Groper) command• The The pingping command is design for command is design for
troubleshooting and tracking a single-point troubleshooting and tracking a single-point hardware or software failure in the Internet. hardware or software failure in the Internet.
• Verifies whether a remote host can be Verifies whether a remote host can be reachedreached
• Shows statistic about packet loss and delivery Shows statistic about packet loss and delivery time.time.
April 5, 2004April 5, 2004 Prof. Paul LinProf. Paul Lin 1515
TCP/IP Utilities and TCP/IP Utilities and TroubleshootingTroubleshooting
Ping (Packet Internet Groper)Ping (Packet Internet Groper)• When called, the ping command sends one When called, the ping command sends one
datagram per seconddatagram per second• Listens for ECHO_RESPONSE returnedListens for ECHO_RESPONSE returned• Sends 4 transmissions of 32-byte each to Sends 4 transmissions of 32-byte each to
verify the network connection by defaultverify the network connection by default• Similar to the function of ICMP (Internet Similar to the function of ICMP (Internet
Control Messaging Protocol) on the IP layerControl Messaging Protocol) on the IP layer
April 5, 2004April 5, 2004 Prof. Paul LinProf. Paul Lin 1616
Using Ping – A Linux ExampleUsing Ping – A Linux Example
[plin@LinMysql plin]$ ping 149.164.36.5[plin@LinMysql plin]$ ping 149.164.36.5PING 149.164.36.5 (149.164.36.5) from 149.164.36.5 : PING 149.164.36.5 (149.164.36.5) from 149.164.36.5 :
56(84) bytes of data.56(84) bytes of data.64 bytes from 149.164.36.5: icmp_seq=1 ttl=64 64 bytes from 149.164.36.5: icmp_seq=1 ttl=64
time=0.214 mstime=0.214 ms64 bytes from 149.164.36.5: icmp_seq=2 ttl=64 64 bytes from 149.164.36.5: icmp_seq=2 ttl=64
time=0.059 mstime=0.059 ms64 bytes from 149.164.36.5: icmp_seq=3 ttl=64 64 bytes from 149.164.36.5: icmp_seq=3 ttl=64
time=0.050 mstime=0.050 ms64 bytes from 149.164.36.5: icmp_seq=4 ttl=64 64 bytes from 149.164.36.5: icmp_seq=4 ttl=64
time=0.055 mstime=0.055 ms
April 5, 2004April 5, 2004 Prof. Paul LinProf. Paul Lin 1717
Using Ping – Another Linux Using Ping – Another Linux ExampleExample
bytes of data.bytes of data.64 bytes from lux.ucs.indiana.edu (129.79.78.4): icmp_seq=1 64 bytes from lux.ucs.indiana.edu (129.79.78.4): icmp_seq=1
ttl=57 time=13.1 msttl=57 time=13.1 ms64 bytes from lux.ucs.indiana.edu (129.79.78.4): icmp_seq=2 64 bytes from lux.ucs.indiana.edu (129.79.78.4): icmp_seq=2
ttl=57 time=12.6 msttl=57 time=12.6 ms64 bytes from lux.ucs.indiana.edu (129.79.78.4): icmp_seq=3 64 bytes from lux.ucs.indiana.edu (129.79.78.4): icmp_seq=3
ttl=57 time=9.65 msttl=57 time=9.65 ms64 bytes from lux.ucs.indiana.edu (129.79.78.4): icmp_seq=4 64 bytes from lux.ucs.indiana.edu (129.79.78.4): icmp_seq=4
ttl=57 time=9.91 msttl=57 time=9.91 ms64 bytes from lux.ucs.indiana.edu (129.79.78.4): icmp_seq=5 64 bytes from lux.ucs.indiana.edu (129.79.78.4): icmp_seq=5
ttl=57 time=9.90 msttl=57 time=9.90 ms
April 5, 2004April 5, 2004 Prof. Paul LinProf. Paul Lin 1818
Using Ping – A MS Windows Using Ping – A MS Windows ExampleExample
C:\>ping 149.164.36.5C:\>ping 149.164.36.5Pinging 149.164.36.5 with 32 bytes of data:Pinging 149.164.36.5 with 32 bytes of data:Reply from 149.164.36.5: bytes=32 time<10ms TTL=63Reply from 149.164.36.5: bytes=32 time<10ms TTL=63Reply from 149.164.36.5: bytes=32 time<10ms TTL=63Reply from 149.164.36.5: bytes=32 time<10ms TTL=63Reply from 149.164.36.5: bytes=32 time<10ms TTL=63Reply from 149.164.36.5: bytes=32 time<10ms TTL=63Reply from 149.164.36.5: bytes=32 time<10ms TTL=63Reply from 149.164.36.5: bytes=32 time<10ms TTL=63Ping statistics for 149.164.36.5:Ping statistics for 149.164.36.5: Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:Approximate round trip times in milli-seconds: Minimum = 0ms, Maximum = 0ms, Average = 0msMinimum = 0ms, Maximum = 0ms, Average = 0ms
April 5, 2004April 5, 2004 Prof. Paul LinProf. Paul Lin 1919
Using Ping – A MS Windows Using Ping – A MS Windows ExampleExample
Ping CommandPing CommandC:\>ping /?C:\>ping /?Usage: ping [-t] [-a] [-n count] [-l size] [-f] [-i TTL] [-v TOS]Usage: ping [-t] [-a] [-n count] [-l size] [-f] [-i TTL] [-v TOS] [-r count] [-s count] [[-j host-list] | [-k host-list]][-r count] [-s count] [[-j host-list] | [-k host-list]] [-w timeout] destination-list[-w timeout] destination-listOptions:Options: -t Ping the specified host until stopped.-t Ping the specified host until stopped. To see statistics and continue - type Control-Break;To see statistics and continue - type Control-Break; To stop - type Control-C.To stop - type Control-C. -a Resolve addresses to hostnames.-a Resolve addresses to hostnames.
April 5, 2004April 5, 2004 Prof. Paul LinProf. Paul Lin 2020
Using Ping – A MS Windows Using Ping – A MS Windows Example Example (continue)(continue)
Options:Options:-n count Number of echo requests to send.-n count Number of echo requests to send.
-l size Send buffer size.-l size Send buffer size. -f Set Don't Fragment flag in packet.-f Set Don't Fragment flag in packet. -i TTL Time To Live.-i TTL Time To Live.
April 5, 2004April 5, 2004 Prof. Paul LinProf. Paul Lin 2121
Using Ping – A MS Windows Using Ping – A MS Windows Example Example (continue)(continue)
Options:Options:-v TOS Type Of Service.-v TOS Type Of Service.
-r count Record route for count hops.-r count Record route for count hops. -s count Timestamp for count hops.-s count Timestamp for count hops. -j host-list Loose source route along host-list.-j host-list Loose source route along host-list. -k host-list Strict source route along host-list.-k host-list Strict source route along host-list. -w timeout Timeout in milliseconds to wait for -w timeout Timeout in milliseconds to wait for