Vous êtes sur la page 1sur 21

Transport Layer:Intro

A single logical connection between processes. Hides intricacies of underlying network structure. Takes an application message, divides it into smaller chunks (called PDUs for protocol data units), adds headers and sends.

UDP
Stands for User Datagram protocol. Acts as a simple demultiplexer between processes.
Once datagram arrives at a destination host, which process is it to be forwarded to ? The processes are distinguished using port numbers.

Note: IP multiplexes data from various processes! Best Effort -- as with IP. UDP applications --DNS, routing updates.

Pictorial view of UDP


Application process Application process Application process Ports

Queues

Packets demultiplexed UDP

Packets arriv e

Ports
Processes identified using port numbers -- an abstraction. 16 bit representation of ports. Destination port is usually well known In Unix usually in /etc/services as an example -- DNS has port 53 on which messages are received. Can use well known port to agree on a different port to communicate.

Port implementation is OS specific -- usually implemented as message queues


UDP appends message to queue.

What does UDP give ?


Just demultiplexing. No flow control No reliable/ordered delivery No congestion control provision. But, message correctness ensured by checksum.

UDP checksum
Computed over the UDP header, the contents of the message body and something called the pseudoheader.
Pseudoheader -- from IP header, contains protocol number, source IP address, destination IP address and UDP length field.

Arrange the contents into 16 bit words, add the words, take the 1s complement and include as checksum.

Why UDP ?
No connection set up. No need to maintain state. Smaller packet overhead (8 bytes whereas TCP has 20 bytes) Unregulated send rate -- especially if packet loss is not an issue.

Transmission Control Protocol (TCP)


Reliable byte stream. Connection oriented -->
Guarantees reliable in-order delivery of a stream of bytes. Has flow control i.e., the receiver can limit the amount of data that the source sends. Does the demultiplexing that UDP does. Includes a congestion control mechanism -- throttle the rate of sending to avoid overloading the network.

TCP basics
A sliding window protocol is at the heart of TCP. TCP establishes an explicit logical connection between a client and a server. There is an explicit connection establishment phase (similar to dialing a connection) -- the two sides agree to exchange data.
There is a explicit teardown phase -- the connection is torn down.
The two parties establish some shared state to enable the sliding window algorithm to begin.

Challenges
Remember, sliding window specifies how many segments should be in flight at a given time. The RTT of a logical connection is highly variable. Delay bandwidth product okay only if there is a single connection -- however, if there are many connections, and the number is varying on the different links through which a TCP connection passes,estimation of this product is difficult. TCP tries to learn about the resources for a connection.

Packet re-ordering and Sequence Nos.


Packets could be re-ordered when the traverse the Internet. Sequence numbers are used to ensure that they arrive in order.
How far out of order ? (to be determined)

Remember -- IP has a TTL


TCP uses this information to define a maximum segment lifetime (defined as MSL). Current recommended setting for MSL is 120 seconds (it is a conservative estimate).

Segments
TCP is a byte oriented protocol -- This means that sender writes bytes into a TCP connection and receiver retrieves bytes. But TCP does not really directly transmit bytes. Buffers enough to fill a reasonably sized data unit called segment and sends it to receiver. Receiver retrieves bytes and stores in buffer.

Pictorial View of the Process


Application process Application process

Write bytes

Read bytes

TCP Send buffer

TCP Receive buffer

Segment

Segment

Segment

Transmit segments

Maximum Segment Size


TCP segment size is limited by what is called MSS (Maximum Segment Size). The largest segment that TCP can send without causing the local IP layer to fragment it.

The Push Operation


One can also invoke the push operation with TCP. Flushes the buffer of unsent bytes
With Push, there is a timer that periodically fires taking what is in the buffer.

supports the operation of terminal emulators (such as talk or chat).

TCP Segment Format


Src Port and Dst Port represent the corresponding port nos. TCPs demux key is {Src Port, Src IP addr, Dst Port, Dst IP addr} Each byte of data contains a sequence number. Sequence number of segment is the sequence number of first byte.
0 4 10 SrcPort SequenceNum Acknowledgment HdrLen 0 Checksum Options (v ariable) Data Flags Adv ertisedWindow UrgPtr 16 DstPort 31

TCP Segment (cont)


ACK and Advertised Window go from receiver to sender (we will see later). Hdr Len -- In terms of 32 bit words. Checksum is over TCP header, TCP data and pseudoheader (as in UDP).
0 4 10 SrcPort SequenceNum Acknowledgment HdrLen 0 Checksum Options (v ariable) Data Flags Adv ertisedWindow UrgPtr 16 DstPort 31

Options -- Time stamps, extension of the adv. window

Flags in TCP header


There are 6 bits for flags. SYN flag -- connection establishment FIN flag -- connection termination ACK flag -- Acknowledgement field is valid -- bytes are being acknowledged, so the receiving TCP entity should pay attention to that field. URG flag --segment contains urgent data (next slide). PUSH flag -- sender invoked PUSH -- send data to application right away. RESET flag : confusion -- abort connection.

Urgent data
Data to interrupt operation underway
called out of band communications.

The Urgent flag says that there is urgent data in the front of the segment body upto what is specified by the UrgPtr field.

Connection Establishment
Client is the caller Server is the callee In the SYN+ACK message, both the SYN and ACK flags are set. It is a three way handshake!
Active participant (client) (server)

The Three Way Handshake


If SYN+ACK is lost, then server is left hanging -- does not know that the client did not get it and therefore might have aborted. If ACK gets lost on the other hand, it is ok -- the sender sends the first segment and so on -- so the connection survives.

Vous aimerez peut-être aussi