0% found this document useful (0 votes)
34 views17 pages

37 Networking Sol

Uploaded by

Aarti Khare
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
34 views17 pages

37 Networking Sol

Uploaded by

Aarti Khare
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 17

Transport Layer: UDP, TCP

Internet Transport Protocols


TCP

UDP
Connection-oriented

Unreliable data transfer Does not provide

setup required between client and server

Reliable transport
Flow control

Connection setup, reliability, flow control, congestion control, timing and throughput guarantee, or security

Wont overwhelm receiver

Congestion control

Wont overwhelm network

Does not provide

Timing and throughput guarantees, security

Copyright : Nahrstedt, Angrave, Abdelzaher, Kravets, Gupta, Caccamo

UDP Services

User Datagram Protocol Service


OSI Transport Layer Provides a thin layer over IP 16-bit port space (distinct from TCP ports) allows multiple recipients on a single host

Copyright : Nahrstedt, Angrave, Abdelzaher, Kravets, Gupta, Caccamo

UDP Services

Unit of Transfer

Datagram (variable length packet) Packet boundaries are preserved when receiving data (a read operation yields packet payload as it was originally sent. No guaranteed delivery Drops packets silently No guarantee of maintained order of delivery No flow control

Postal Mail

Unreliable

Unreliable Not necessarily in-order Letters sent independently Must address each reply

Unordered

Unlimited Transmission

Copyright : Nahrstedt, Angrave, Abdelzaher, Kravets, Gupta, Caccamo

UDP Packet structure

Quiz: by locking at UDP packet structure, can you guess what services are provided by UDP?

bits

0-15

0 32 64

Source port Length


Data

16-31 Destination port Checksum

Copyright : Nahrstedt, Angrave, Abdelzaher, Kravets, Gupta, Caccamo

UDP Packet structure

UDP provides

application multiplexing (via port numbers) integrity verification (via checksum) of the header and payload packets are sent individually and error checked only if they arrive if any kind of transmission reliability is needed, it must be implemented at application level bits 0-15 16-31 Destination port Checksum

0 32 64

Source port Length


Data

Copyright : Nahrstedt, Angrave, Abdelzaher, Kravets, Gupta, Caccamo

When should I use UDP?

Why should I use UDP? After all, TCP is a better algorithm!

Copyright : Nahrstedt, Angrave, Abdelzaher, Kravets, Gupta, Caccamo

When should I use UDP?


Why should I use UDP? After all, TCP is a better algorithm! Reliability of TCP comes with some costs

TCP needs 3 packets to set up a connection UDP header has 8 bytes instead of 20 (like TCP header) UDP is a better choice for interactive (soft real-time) voice and video traffic (like Skype). During real-time streaming, it is better to occasionally lose few packets (slight QoS degradation) rather than introducing large delays if lost packets are retransmitted.

Copyright : Nahrstedt, Angrave, Abdelzaher, Kravets, Gupta, Caccamo

TCP Connections

Transmission Control Protocol (TCP) Service


TCP is a protocol running on OSI Transport Layer Service Model

Byte stream (interpreted by application); packet boundaries cannot be distinguished by application 16-bit port space allows multiple connections on a single host Connection-oriented

Copyright : Nahrstedt, Angrave, Abdelzaher, Kravets, Gupta, Caccamo

Set up connection before communicating Tear down connection when done

TCP Service

Reliable Data Transfer


Guaranteed delivery Exactly once

Sequenced Data Transfer

In-order delivery
Monitors network and adjusts transmission appropriately Full-Duplex byte stream

Regulated Data Flow

Data Transmission

Copyright : Nahrstedt, Angrave, Abdelzaher, Kravets, Gupta, Caccamo

TCP Connection Establishment

3-Way Handshake

Passive open
Active open

Sequence Numbers

J,K Synchronize (SYN) Acknowledge (ACK) Server listens for connection from client Client initiates connection to server

Message Types

Client

Server
listen

Passive Open

Active Open

Time flows down


Copyright : Nahrstedt, Angrave, Abdelzaher, Kravets, Gupta, Caccamo

TCP Connection Termination

Either client or server can initiate connection teardown (4way handshake)

Active close

Client

Passive close Server

Message Types

Finished (FIN) Acknowledge (ACK)

3-way handshake is also possible. The sequence is FIN J, ACK J+1 & FIN K (as single packet), ACK K+1
Time flows down

Copyright : Nahrstedt, Angrave, Abdelzaher, Kravets, Gupta, Caccamo

TCP Reliable transmission


TCP uses a sequence number to identify each byte of data.


When establishing a connection, the 3-way handshake allows remote hosts to exchange and ACK an initial sequence number (ISN). Exploiting sequence numbers, data can be reconstructed in order, regardless of fragmentation, lack of ordering, or packet loss Sequence number is incremented for each payload byte that is sent.

Receiver uses cumulative acknowledgment For example, if host A sends 10 bytes with sequence numbers 100 to 109, then the receiver transmits ACK 110 since next expected byte should have sequence number 110

Copyright : Nahrstedt, Angrave, Abdelzaher, Kravets, Gupta, Caccamo

TCP Segment Format


TCP segments have a 20 byte header with >= 0 bytes of data.
IP header
20 bytes 0 Source Port Number

TCP header
20 bytes 15 16

TCP data

31

Destination Port Number

Sequence number (32 bits)


20 bytes

Acknowledgement number (32 bits)


header length 0

Flags

window size urgent pointer

TCP checksum

Options (if any) DATA


Copyright Jorg Liebeherr 98, Modified with permission, Abdelzaher

TCP header fields

Port number

A port number identifies the endpoint of a connection A pair <IP address, port number> identifies one endpoint of a connection Two pairs <client IP address, client port number> and <server IP address, server port number> identify a TCP connection
Applications Applications

Ports:

23 80 104 TCP IP

80 16 TCP IP

Ports:

Copyright Jorg Liebeherr 98, Modified with permission, Abdelzaher

TCP header fields

Sequence Number (SeqNo):


Sequence number is 32 bits long. Each sequence number identifies a byte in the byte stream Initial Sequence Number (ISN) of a connection is set during connection establishment

Copyright Jorg Liebeherr 98, Modified with permission, Abdelzaher

TCP header fields

Acknowledgement Number (AckNo):


Acknowledgements are piggybacked A host uses the AckNo field to send acknowledgements. (If AckNo has a valid value, then the ACK flag is set) The AckNo contains the next SeqNo that a host (receiver) expects to receive Example: The acknowledgement for a segment with sequence numbers 0-1500 is AckNo=1501

Copyright Jorg Liebeherr 98, Modified with permission, Abdelzaher

You might also like