21
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

  • Upload
    yeva

  • View
    41

  • Download
    6

Embed Size (px)

DESCRIPTION

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

Citation preview

Page 1: CPET 355 Data Communications & Networking

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

Page 2: CPET 355 Data Communications & Networking

April 5, 2004April 5, 2004 Prof. Paul LinProf. Paul Lin 22

Transmission Control Protocol Transmission Control Protocol (TCP)(TCP)

Request For Comment StandardRequest For Comment Standard• RFC 793 – originalRFC 793 – original• RFC 1122 – revisedRFC 1122 – revised• RFC 1323 – extensionRFC 1323 – extension

Connection-oriented serviceConnection-oriented service• Accepts user data stream from local process Accepts user data stream from local process

(running program)(running program)• Break the up into pieces (< 64 KB, often 1460 Break the up into pieces (< 64 KB, often 1460

bytes) as IP datagrambytes) as IP datagram• Using specific portUsing specific port

Page 3: CPET 355 Data Communications & Networking

April 5, 2004April 5, 2004 Prof. Paul LinProf. Paul Lin 33

Transmission Control Protocol Transmission Control Protocol (TCP)(TCP)

TCP/IP ConnectionsTCP/IP Connections• Full-duplexFull-duplex• Point-to-pointPoint-to-point

TCP/IP SuitesTCP/IP Suites• FTP – file transfer (control port 21, data port FTP – file transfer (control port 21, data port

20)20)• Telnet – remote login terminal service (port 23)Telnet – remote login terminal service (port 23)• SMTP – E-mail (port 25)SMTP – E-mail (port 25)• HTTP – HyperText Transfer Protocol (port 80)HTTP – HyperText Transfer Protocol (port 80)

Page 4: CPET 355 Data Communications & Networking

April 5, 2004April 5, 2004 Prof. Paul LinProf. Paul Lin 44

Transmission Control Protocol Transmission Control Protocol (TCP)(TCP)

Transport layer duties:Transport layer duties:• End-to-end delivery (treat individual packets End-to-end delivery (treat individual packets

independently)independently)• Addressing (many-to-many entities called Addressing (many-to-many entities called

service points)service points)• Reliable delivery (error control, sequence Reliable delivery (error control, sequence

control, loss control, and duplication control)control, loss control, and duplication control)• Flow control Flow control • MultiplexingMultiplexing

Page 5: CPET 355 Data Communications & Networking

April 5, 2004April 5, 2004 Prof. Paul LinProf. Paul Lin 55

The TCP HeaderThe TCP Header

From Figure 6-29, Page 537, Computer Networks, 4th Ed, Andrew Tanenbaum, Prentice Hall

Page 6: CPET 355 Data Communications & Networking

April 5, 2004April 5, 2004 Prof. Paul LinProf. Paul Lin 66

The TCP Segment HeaderThe TCP Segment Header

Max Data BytesMax Data Bytes• 20-byte header20-byte header• 65,495 bytes data = 65535 – 20 bytes 65,495 bytes data = 65535 – 20 bytes

(TCP header) – 20 bytes (IP header)(TCP header) – 20 bytes (IP header)

Page 7: CPET 355 Data Communications & Networking

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

TCP Header Length (4-bit)TCP Header Length (4-bit)

Page 8: CPET 355 Data Communications & Networking

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

Page 9: CPET 355 Data Communications & Networking

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

Page 10: CPET 355 Data Communications & Networking

April 5, 2004April 5, 2004 Prof. Paul LinProf. Paul Lin 1010

The Main Functions of TCPThe Main Functions of TCP

Session establishmentSession establishment Byte stream communicationsByte stream communications Sliding windowsSliding windows

Page 11: CPET 355 Data Communications & Networking

April 5, 2004April 5, 2004 Prof. Paul LinProf. Paul Lin 1111

The Main Functions of TCPThe Main Functions of TCPSession EstablishmentSession Establishment

A TCP Three-way HandshakeA TCP Three-way Handshake

HOST1HOST1 SYN. Data SYN. Data HOST2HOST2

ACK, SYN. Data ACK, SYN. Data ACK ACK

Page 12: CPET 355 Data Communications & Networking

April 5, 2004April 5, 2004 Prof. Paul LinProf. Paul Lin 1212

TCP Byte Stream CommunicationsTCP Byte Stream Communications

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

Page 13: CPET 355 Data Communications & Networking

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

Page 14: CPET 355 Data Communications & Networking

April 5, 2004April 5, 2004 Prof. Paul LinProf. Paul Lin 1414

TCP/IP Troubleshooting UtilitiesTCP/IP Troubleshooting Utilities

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.

Page 15: CPET 355 Data Communications & Networking

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

Page 16: CPET 355 Data Communications & Networking

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

Page 17: CPET 355 Data Communications & Networking

April 5, 2004April 5, 2004 Prof. Paul LinProf. Paul Lin 1717

Using Ping – Another Linux Using Ping – Another Linux ExampleExample

[plin@LinMysql plin]$ ping -c 10 www.iu.edu[plin@LinMysql plin]$ ping -c 10 www.iu.eduPING www.iu.edu (129.79.78.4) from 149.164.36.129 : 56(84) PING www.iu.edu (129.79.78.4) from 149.164.36.129 : 56(84)

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

Page 18: CPET 355 Data Communications & Networking

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

Page 19: CPET 355 Data Communications & Networking

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.

Page 20: CPET 355 Data Communications & Networking

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.

Page 21: CPET 355 Data Communications & Networking

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

each reply.each reply.