The Transport Layer

Note on 22 Jul 2002
Services provided
  • Goal of the transport layer is to provide efficient reliable & cost effective service to higher levels (normally applications)
  • Normally provides connection oriented & connectionless services
  • Functions in a similar manner to network layer
QoS
  • Another way of looking at transport layer is that it's primary function is to enhance the "Quality of Service" of the network layer
  • What exactly good is, is best left up to the user
    Connection establishment delay
    Connection establishment failure probability
    Throughput
    Transit delay
    Residual error ratio
    Protection
    Priority
    Resilience
Transport Service primitives
  • Many programs & programmers use transport layer so primitives must be easy to use and understand
PrimitivePDPU sentMeaning
LISTENnoneBlock until some process tries to connect
CONNECTCONNECTION REQ.Actively attempt
SENDDATASend information
RECEIVEnoneBlock until DATA TPDU arrives
DISCONNECTDISCONNECTION REQ.This side wants to release connection
Berkeley Socket primitives
BINDLISTEN
PrimitiveMeaning
SOCKETCreate a new communication end point
Attach a local address to a socket
Announce willingness to accept connection: give queue size
ACCEPTBlock the caller until a connection attempt arrives
CONNECTActively attempt to establish a connection
SENDSend data over the connection
RECEIVEReceive data from the connection
CLOSERelease the connection
Transport layer VS Data Link Layer
  • Transport layer is similar in many respects to data link layer, but there are some important differences

Datalink LayerTransport Layer
AddressingUnnecessary, output lines are already knownExplicit addressing is needed
ConnectionSimpleComplex
StorageNegligbleSignificant
Amount of dataContinuous streamLarge, varying number of connections
Addressing
  • When an application wishes to setup an connection - how to we specify which remote application to use?
    • Ans: Use Transport Service Access Point (TSAPs) and Network Service Access Points (NSAPs)
  • How do we find out what TSAPs to use?
    • Well known services list
    • Directory server
  • How do we find the NSAP for our TSAP?
    • Use a hierarchical TSAP address that contain NSAP
    • Use flat TSAP with name server to find NSAP
    • Ask
Establishing a connection
  • Biggest problem with establishing a connection is the problem of duplicate packets
    1. Sender sends datagram to receiver, but due to congestion, these packets timeout
    2. Sender resends packets, which take a different route to receiver
    3. Old packets eventually get through congestion and reach receiver
  • To solve problem need to restrict packet lifespan
    1. Restricted subnet design
    2. Hop counter
    3. Timestamping each packet
Establishing a connection - duplicate data packets
  • let t = lifetime of a packet, let T = ct
  • Equip each host with a time of day clock
    • that never stops
    • is a binary counter with number of bits >= number of bits in sequence number
  • When connection is setup k low order bits are used as sequence number
  • Sequence numbers are not allowed to be used for a time T before their use as initial sequence numbers
Establishing a connection - duplicate connection packets
Releasing a connection
  • Asymmetric release
    • may loose data
  • Symmetric release
    • Impossible to do correctly - 2 army problem
    • Timers must be used to help alleviate problem
Flow control & buffering
  • Similar to data link layer, but transport layer has to deal with more connections
  • If network service is unreliable then sender must buffer
  • If network service is reliable and the receiver can guarantee to accept all TPDUs then the receiver can buffer, but the sender does not have to
Buffers
  • The best place to buffer depends on the type of traffic carried
    • low bandwidth, bursty traffic - buffer at sender
    • high bandwidth, smooth traffic - buffer at receiver

Dynamic buffer allocation
NoFromMessageComment
1A->B<req 8 buffers>A wants 8 buffers
2B<-A<ack=15, buf=4>B grants messages 0-3 only
3A->B<seq=0, data=m0>A has 3 buffers left
4A->B<seq=1, data=m1>A has 2 buffers left
5A->...<seq=2, data=m2>Message lost, but A thinks it only has 1 left
6B<-A<ack=1, buf=3>B acknowledge 0 & 1, permits 2-4
7A->B<seq=3, data=m3>A has 1 buffer left
8A->B<seq=4, data=m4>A has 0 buffers left and must stop
9A->B<seq=2, data=m2>A times out and retransmit
10B<-A<ack=4, buf=0>Everything acknowledge, but A still blocked
11B<-A<ack=4, buf=1>A may now send 5
12B<-A<ack=4, buf=2>B has found a spare buffer
13A->B<seq=5, data=m5>A has 1 buffer left
14A->B<seq=6, data=m6>A is now blocked again
15B<-A<ack=6m buf=0>A is still blocked
16..<-B<ack=6, buf=4>Problems!!

Crash recovery
  • Problems can occur if host crashes during dta transfer

Strategy used by receiver
First Ack then WriteFirst write then Ack
AC(W)AWCC(AW)C(WA)WACWC(A)
Always retransmitOKDUPOKOKDUPDUP
Never retransmitLOSTOKLOSTLOSTOKOK
Retransmit in S0OKDUPLOSTLOSTDUPOK
Retransmit in S1LOSTOKOKOKOKDUP

Internet Transport Protocols
  • 2 main transport level protocols
  • TCP - Transport control protocol
    • Guaranteed connection oriented service
  • UDP - Universal Datagram Protocol
    • Unguaranteed connectionless service
    • Essentially IP with an additional header
TCP services
  • TCP uses ports in range 0-65,535 (ports below 1024 are reserved and known as well known ports)
  • TCP connections are full duplex and point to point
  • TCP connections are bytes streams not message streams (i.e. message boundaries are not preserved by TCP)
  • TCP is lazy - it may send all the data immediately, or it may buffer it to send later
  • Users can use PUSH flag to force TCP to try and send immediately (like flush in file system)
  • URGENT flag is also used to force TCP to send data immediately
TCP Protocol
  • Basic protocol is variant on sliding window protocol
  • Sequence numbers are 32 bits
  • TCPs exchange data in the form of a segment, each segment consists of header plus zero or more data bytes
  • Segment size is limited by
    • 65,535 IP limit
    • Maximum Transfer Unit (MTU) of network
TCP header
TCP connection management - making a connection
TCP connection management - breaking a connection
TCP transmission policy
TCP congestion control
  • Standard TCP assumes that retransmissions are caused by congestion
  • TCP assumes 2 types of congestion - each with their own window
    • Network congestion
    • Receiver congestion
  • The number of bytes that can be transmitted at any one time is the minimum of the 2
Congestion control - Network congestion
  • Slow start
    1. ms=maximum segment size in use on connection; cw=congestion window
    2. cw:= ms; n:=1
    3. send n segments & start timer
    4. if acknowledge then
      n:=2*n; cw:=n*ms
      goto 3
    5. if timeout then
      cw:=ms
  • Internet congestion control algorithm
    1. threshold:=64k
    2. When timeout
      threshold:=1/2*cw; cw:= ms; n:=1
    3. Send n segments & start timer
    4. If acknowledge then
      if cw >= threshold then
      n:=n+1; cw:=n * ms; goto 3
      else
      n:=2*n; cw:= n* ms; goto 3
    5. If timeout then
      cw:=ms
UDP header

Comments

Popular posts from this blog

The Network Layer