Introduction to Transport Protocols: Transmission Control Protocol (TCP) & User Datagram Protocol...

25
Introduction to Transport Protocols: Transmission Control Protocol (TCP) & User Datagram Protocol (UDP) Chapters 24 & 25 CS 455/555 Data Communications and Computer Networks – Fall 2005
  • date post

    21-Dec-2015
  • Category

    Documents

  • view

    225
  • download

    1

Transcript of Introduction to Transport Protocols: Transmission Control Protocol (TCP) & User Datagram Protocol...

Introduction to Transport Protocols:Transmission Control Protocol (TCP)

& User Datagram Protocol (UDP)

Chapters 24 & 25

CS 455/555 Data Communications and Computer Networks – Fall 2005

Reliable Stream transport Service• Problem: If underlying protocol is

unreliable, how do we guarantee efficient, reliable delivery?– Write complex applications that handle

network-related error conditions– Increase the complexity of the underlying

protocols to include reliable transport– Develop a general purpose protocol that

guarantees reliable stream delivery and that removes reliability responsibilities from the applications and lower-layer protocols.

Introduction

• Internet Protocol (IP) provides “unreliable datagram service” between hosts. At the IP layer, a destination address only identifies a host computer. – For which user or application?

• Transport protocols provide end-to-end delivery between endpoints of a connection, e.g., processes or programs.

End-to-End Communication

Introduction (continued)

• IP datagram service is unreliable in that datagrams may be– Lost (usually dropped due to congestion)– Duplicated– Delivered out of order

• TCP provides reliable service nevertheless

• Challenge: – How to provide a reliable transport service over

unreliable (conceptually) technology?

Transport and Network Layers• Transport Layer Services:

– Reliable/Unreliable data transfer

– Delay guarantees

– Bandwidth guarantees

– Security

• Transport protocol is built using services from Network Layer

• Transport services can be constrained by the services of the underlying network layer protocol– Delay and bandwidth guarantees

– Unreliable data transfer

Internet Transport Layer• User Datagram Protocol (UDP) and

Transmission Control Protocol (TCP) are Internet transport layer protocols

• We refer to layer 4 PDU as a segment (for both UDP and TCP)

• The Network Layer protocol, IP, is a best-effort delivery service (unreliable).

• UDP and TCP provide application multiplexing & demultiplexing and data integrity

Multiplexing/Demultiplexing

Protocol software throughout the layers multiplex or demultiplex among objects at the next layer.

– At the transport layer level:• Demultiplexing - delivering segments to the correct

application process

• Multiplexing - gathering data at the source host from different processes and encapsulation

Demultiplexing

incoming frame

RARPARP

UDP

Application Application

TCP

Application Application

IGMPICMP

EthernetDriver

IP

Application

Transport

Network

Link

Demultiplexing Details

(Ethernet frame types in hex, others in decimal)

destaddr

sourceaddrEthernet frame type data CRC

destaddr

sourceaddr dataprotocol type

IP header

hdrcksumARP

RARPNovell

IP

Others

AppleTalk

dataTCP src port

headerTCP dest

port

FTPserver

telnetserver

echoserver

discardserver23

7

921User processUser processUser processUser process

1024-5000

UDP176

IGMP

ICMP 1

2

TCP

IPIP

TCPTCP

x0800

x8035x0806

TCP Connections

• Virtual

• An ordered pair of endpoints– An endpoint is an ordered pair containing

• An IP address

• A TCP port number

• This information is kept by the OS– netstat

Port Numbers

• TCP and UDP use port numbers to identify the applications at each end of a communication.

• How are these port numbers chosen?

FTP client,port 1184

FTP server,port 21

FTP protocol

TCP

IP

EthernetDriver

TCP

IP

EthernetDriver

TCP protocol

IP protocol

Ethernet protocol

How port numbers are chosen• Port numbers are managed by the Internet Assigned

Numbers Authority (IANA)– http://www.iana.org/assignments/port-numbers

• Servers are known by their well-known port number

e.g. FTP TCP port 21Telnet TCP port 23Biff UDP port 512

• Clients use ephemeral port numbers(“ephemeral” means “short-lived”)

• Most (but not all) TCP/IP implementations allocate ephemeral 1024-5000

How port numbers are chosen• The port numbers are divided into three ranges:

– the Well Known Ports,

– the Registered Ports,

– and the Dynamic and/or Private Ports.

• The Well Known Ports are those from 0 through 1023.

• The Registered Ports are those from 1024 through 49151

• The Dynamic and/or Private Ports are those from 49152 through 65535

Well-known port numbers• Can be found in /etc/services on Unix system

• Are independent on UDP vs. TCP, but when same service is offered, same number is used

[codd:~] [9:57am] -> grep telnet /etc/services

telnet 23/tcp

[codd:~] [9:57am] -> grep daytime /etc/services

daytime 13/tcp

daytime 13/udp

[codd:~] [9:58am] -> grep echo /etc/services

echo 7/tcp

echo 7/udp

Reserved Ports

• On Unix systems, ports between 1 and 1023 are reserved ports

• Only a superuser process can assign itself a reserved port

• This fact is used by some applications (e.g. rlogin) to implement security between client and server.– not very secure however, in era of PC’s and

workstations!!!

Some Sample Services

• There are a few standard, simple services that almost every TCP/IP implementation provides.

• Three examples:TCP UDP

Name port port RFC Description

echo 7 7 862 server echoes what client sendsdiscard 9 9 863 server discards what client sendsdaytime 13 13 867 server returns time/date in ascii

UDP

• Adds very little to IP:– Multiplexing/demultiplexing– Error checking

• Some applications are better suited for UDP because:– No connection establishment– No connection state– Small packet overhead– Unregulated send rate– Multicast

Applications and Transport Protocols

ApplicationApplication-Layer Protocol

Underlying Transport Protocol

Email SMTP TCP

Remote Terminal Access Telnet TCP

Web HTTP TCP

File Transfer FTP TCP

Remote File Server NFS Typically UDP

Streaming Multimedia Proprietary Typically UDP

Network Management SNMP Typically UDP

Routing Protocol RIP Typically UDP

Name Translation DNS Typically UDP

Internet Telephony Proprietary Typically UDP

TCP

• Transmission Control Protocol (TCP) is most widely used transport protocol

• Provides reliable data delivery by using IP unreliable datagram delivery

• Compensates for loss, delay, duplication and similar problems in Internet components

• Reliable delivery is high-level, familiar model for construction or applications

TCP

• TCP is protocol (rules, formats), not a piece of software

• “specifies the format of data and acknowledgements that two computers exchange in order to achieve reliable transfer, as well as the procedures the computers use to ensure that data arrives correctly”

• Determines how hosts should recover from errors like lost or duplicate packets

• Details initiation and completion procedures for a TCP stream transfer between 2 hosts

TCP Services

• Characteristics of services provided to applications:– connection-oriented:

• Connection state resides entirely on end system

• end nodes must agree before transfer can begin

– Point-to-point:• TCP uses port to identify the destination user process within a host

• After port numbers are assigned on both ends, transfer may begin

• Does not allow multicasting

– complete reliability: no data loss or out-of-order

– Provides full duplex communication:• concurrent transfer in both ways

• appears as 2 independent streams

– Stream interface:• data sent to or received from TCP in streams of bits,

divided into octets

• unstructured datastream: does not honor “structured” streams of data (like records in a file)

• buffered transfer - protocol SW free to divide streams into packets regardless of how the application sends

– reliable connection startup:• Virtual Circuit connection - contact made; negotiate for

reliability options; inform applications of ready status

– graceful connection shutdown;• all data guaramteed to be delivered before closing the

connection

TCP “Service” Summary• Transport layer makes data transmission transparent to

the upper layers• Responsible for end-to-end delivery, segmentation and

concatenation• TCP provides a service to the application layer which

is:– connection-oriented: connection established before

communication takes place, terminated when done, through 3-way handshakes.

– byte-stream: no record boundaries, no structure, just a sequence of bytes.

TCP “Service” Summary (cont.)– reliable:

• no loss: lost packets are retransmitted

• no corruption: checksums insure integrity

• ordered: data delivered in the order it was received

• no duplicates

– flow controlled: fast sender will not overwhelm slow receiver, or waste bandwidth on the network, entire network cooperates to avoid congestion.

– full-duplex: every connection is bi-directional.