Transcript ICOM 6115
ICOM 6115 – Computer Networks
and the WWW
Manuel Rodriguez-Martinez, Ph.D.
Lecture 26
ICOM 6115
©Manuel Rodriguez-Martinez
Lecture Objectives
• Introduction to Transport Layer
– Layer 4
– User Datagram Protocol (UDP)
– Transmission Control Protocol (TCP)
ICOM 6115
©Manuel Rodriguez-Martinez
Transport Layer
• Provides reliable, cost-effective way to
move data between two applications
– independent of type of layer 3
• Application level API often interact with
this module
• Sockets are built on top of transport layer
– TCP Sockets
– UDP Sockets
ICOM 6115
©Manuel Rodriguez-Martinez
Layer 3, Layer 4 and Layer 5 Stack
ICOM 6115
©Manuel Rodriguez-Martinez
Transport services
• Connectionless
– Blocks of data sent over datagrams
• Targeted for a specific process on a given machine
• Connection-oriented
– Reliable stream of bytes sent between two
processes
– Adds reliability to layer 3
• Transport entity
– Module that uses the network layer to move
data (inside OS of hosts)
ICOM 6115
©Manuel Rodriguez-Martinez
Typical Operations
• LISTEN (usually server side)
– Wait for a connection to occur
• CONNECT (usually client side)
– Request a connection to be established
• SEND
– Move some amount of data between processes
• RECEIVE
– Accepts some amount of data
• DISCONNECT (bidirectional)
– Terminate the connection
ICOM 6115
©Manuel Rodriguez-Martinez
Encapsulation at layer 4
• Data is packaged into TPDU
– TPDU – Transport Protocol Data Unit
ICOM 6115
©Manuel Rodriguez-Martinez
Typical State Transition Diagram
ICOM 6115
©Manuel Rodriguez-Martinez
Addressing
• Transport layer identifies process by:
– <Layer 3 Address, Port number>
• Idea
– Layer 3 Address identifies host on which process is
running
• Network Service Access Point (NSAP)
• IP address
– Port uniquely identifies a process on that host
• Transport Services Access Point (TSAP)
• Applications use to port to index data structure
where data is placed
– Send and receive operations
ICOM 6115
©Manuel Rodriguez-Martinez
Example of NSAPs and TSAPs
ICOM 6115
©Manuel Rodriguez-Martinez
Connection daemon
ICOM 6115
©Manuel Rodriguez-Martinez
Connection daemon
• Connection daemon is used to spawn a new
process to service a client request
• Often used if we do not want to have a server
running all the time on background
– Ex. inetd can spawns telnet processes
• OS must support way to pass variable
– Pass context of process
– UNIX
• Fork() operation
– Windows
• Threads
ICOM 6115
©Manuel Rodriguez-Martinez
Demultiplexing data
Process
Process
Port
Message Queues
Layer 4
Layer 3
ICOM 6115
©Manuel Rodriguez-Martinez
Process
User Datagram Protocol (UDP)
• Provides a mechanism to send datagrams
between processes
– Blocks of data are sent
• Just adds port information on top of IP packet
– Can arrive delayed, out of order, or get lost
• Unreliable services
– Need to add ACKs if you want more
• Some applications that use it
– DNS (Domain Name Services)
– NFS (Network File System)
ICOM 6115
©Manuel Rodriguez-Martinez
UDP Header
ICOM 6115
©Manuel Rodriguez-Martinez
Transmission Control Protocol (TCP)
• Provides a reliable byte stream between
processes
• Data is guaranteed to
– arrive safely
– Be organized in the proper order and read in
order
• TCP streams provide the abstraction of a
byte stream
– Like a file
ICOM 6115
©Manuel Rodriguez-Martinez
TCP Byte Stream
ICOM 6115
©Manuel Rodriguez-Martinez
Buffering Data in TCP
• Data is buffered until enough is present to
be sent or read
• Alternatively, the buffer can be flushed to
force data out
ICOM 6115
©Manuel Rodriguez-Martinez
TCP Header
ICOM 6115
©Manuel Rodriguez-Martinez
TCP Three Way Handshake
• Use to establish a connection
• Client sends SYN message with a seq
number x
• Server replies with
– SYN indicating its own sequence numbers y
– ACK indicating it expects data with seq x + 1
• Client replies with ACK indicating it
expects data with seq y + 1
• Sequence numbers address bytes!
ICOM 6115
©Manuel Rodriguez-Martinez
Timeline diagram
ICOM 6115
©Manuel Rodriguez-Martinez
Some Issues
• Need to way for 3-way handshake before
sending data
– How long is this?
• This is bad for short live connection that
send little data
– HTPP request with small number of images
ICOM 6115
©Manuel Rodriguez-Martinez