The Transport Layer
Note on 22 Jul 2002
Services provided
Berkeley Socket primitives
Addressing
Releasing a connection
Dynamic buffer allocation
Crash recovery
Internet Transport Protocols
TCP connection management - making a connection
TCP connection management - breaking a connection
TCP transmission policy
TCP congestion control
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
- 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
- Many programs & programmers use transport layer so primitives must be easy to use and understand
Primitive | PDPU sent | Meaning |
---|---|---|
LISTEN | none | Block until some process tries to connect |
CONNECT | CONNECTION REQ. | Actively attempt |
SEND | DATA | Send information |
RECEIVE | none | Block until DATA TPDU arrives |
DISCONNECT | DISCONNECTION REQ. | This side wants to release connection |
BINDLISTEN
Transport layer VS Data Link Layer
Primitive | Meaning |
---|---|
SOCKET | Create a new communication end point |
Attach a local address to a socket | |
Announce willingness to accept connection: give queue size | |
ACCEPT | Block the caller until a connection attempt arrives |
CONNECT | Actively attempt to establish a connection |
SEND | Send data over the connection |
RECEIVE | Receive data from the connection |
CLOSE | Release the connection |
- Transport layer is similar in many respects to data link layer, but there are some important differences
Datalink Layer | Transport Layer | |
---|---|---|
Addressing | Unnecessary, output lines are already known | Explicit addressing is needed |
Connection | Simple | Complex |
Storage | Negligble | Significant |
Amount of data | Continuous stream | Large, varying number of connections |
- 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
- Biggest problem with establishing a connection is the problem of duplicate packets
- Sender sends datagram to receiver, but due to congestion, these packets timeout
- Sender resends packets, which take a different route to receiver
- Old packets eventually get through congestion and reach receiver
- To solve problem need to restrict packet lifespan
- Restricted subnet design
- Hop counter
- Timestamping each packet
- 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
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
- 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
- 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
No | From | Message | Comment |
---|---|---|---|
1 | A->B | <req 8 buffers> | A wants 8 buffers |
2 | B<-A | <ack=15, buf=4> | B grants messages 0-3 only |
3 | A->B | <seq=0, data=m0> | A has 3 buffers left |
4 | A->B | <seq=1, data=m1> | A has 2 buffers left |
5 | A->... | <seq=2, data=m2> | Message lost, but A thinks it only has 1 left |
6 | B<-A | <ack=1, buf=3> | B acknowledge 0 & 1, permits 2-4 |
7 | A->B | <seq=3, data=m3> | A has 1 buffer left |
8 | A->B | <seq=4, data=m4> | A has 0 buffers left and must stop |
9 | A->B | <seq=2, data=m2> | A times out and retransmit |
10 | B<-A | <ack=4, buf=0> | Everything acknowledge, but A still blocked |
11 | B<-A | <ack=4, buf=1> | A may now send 5 |
12 | B<-A | <ack=4, buf=2> | B has found a spare buffer |
13 | A->B | <seq=5, data=m5> | A has 1 buffer left |
14 | A->B | <seq=6, data=m6> | A is now blocked again |
15 | B<-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 Write | First write then Ack | |||||
AC(W) | AWC | C(AW) | C(WA) | WAC | WC(A) | |
Always retransmit | OK | DUP | OK | OK | DUP | DUP |
Never retransmit | LOST | OK | LOST | LOST | OK | OK |
Retransmit in S0 | OK | DUP | LOST | LOST | DUP | OK |
Retransmit in S1 | LOST | OK | OK | OK | OK | DUP |
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 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
- 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 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
- Slow start
- ms=maximum segment size in use on connection; cw=congestion window
- cw:= ms; n:=1
- send n segments & start timer
- if acknowledge then
n:=2*n; cw:=n*ms
goto 3 - if timeout then
cw:=ms
- Internet congestion control algorithm
- threshold:=64k
- When timeout
threshold:=1/2*cw; cw:= ms; n:=1 - Send n segments & start timer
- If acknowledge then
if cw >= threshold then
n:=n+1; cw:=n * ms; goto 3
else
n:=2*n; cw:= n* ms; goto 3 - If timeout then
cw:=ms
Comments
Post a Comment