computer networks - transport layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · computer...

252
Computer Networks Transport Layer Paolo Costa [email protected] http://www.cs.vu.nl/~costa Vrije Universiteit Amsterdam June 13, 2008 Paolo Costa 06 - Transport Layer 1 / 52

Upload: ngokiet

Post on 08-Jul-2018

219 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Computer NetworksTransport Layer

Paolo [email protected]

http://www.cs.vu.nl/~costa

Vrije Universiteit Amsterdam

June 13, 2008

Paolo Costa 06 - Transport Layer 1 / 52

Page 2: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Transport Layer

The transport layer protocolsprovides for logicalcommunication betweenapplication processes (nothosts)

provides reliableconnection-orientedservicesprovides unreliableconnectionless servicesprovides parameters forspecifying quality of services

Depending on the underlyingnetwork layer, the addedfunctionality can be big orsmall

Paolo Costa 06 - Transport Layer Transport Service 2 / 52

Page 3: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Transport Layer

The transport layer protocolsprovides for logicalcommunication betweenapplication processes (nothosts)

provides reliableconnection-orientedservicesprovides unreliableconnectionless servicesprovides parameters forspecifying quality of services

Depending on the underlyingnetwork layer, the addedfunctionality can be big orsmall

Paolo Costa 06 - Transport Layer Transport Service 2 / 52

Page 4: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Transport Layer

The transport layer protocolsprovides for logicalcommunication betweenapplication processes (nothosts)

provides reliableconnection-orientedservicesprovides unreliableconnectionless servicesprovides parameters forspecifying quality of services

Depending on the underlyingnetwork layer, the addedfunctionality can be big orsmall

Paolo Costa 06 - Transport Layer Transport Service 2 / 52

Page 5: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Transport Layer vs. Network Layer

The network layer is in the hands of carriersclients have no say in what the carrier actually offers

To develop applications that are independent of the particularservices offered by a carrier, a standard communication interfaceis needed

the transport layer implements such interface.

Paolo Costa 06 - Transport Layer Transport Service 3 / 52

Page 6: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Transport Layer vs. Network Layer

The network layer is in the hands of carriersclients have no say in what the carrier actually offers

To develop applications that are independent of the particularservices offered by a carrier, a standard communication interfaceis needed

the transport layer implements such interface. Paolo Costa 06 - Transport Layer Transport Service 3 / 52

Page 7: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Transport Layer Interface

Example: Consider the Berkeley socket interface, which has beenadopted by all UNIX systems, as well as Windows:

SOCKET Create a new communication endpointBIND Attach a local address to a socket

LISTEN Announce willingness to accept N connectionsACCEPT Block until someone remote wants to establish a connectionCONNECT Attempt to establish a connectionSEND Send data over a connectionRECEIVE Receive data over a connectionCLOSE Release the connection

The client and server each bind a transport-level address and a name to thelocally created socket.The server must listen to its socket, thereby telling the kernel that it willsubsequently wait for connections from clients.After that, the server can accept or select connections from clients.The client connects to the socket.

it needs to provide the transport-level address by which it canlocate the server.

Now the client and server communicate through send/receive operations on theirrespective sockets.

also standard read / write operations can be usedCommunication ends when a connection is closed.

Paolo Costa 06 - Transport Layer Transport Service 4 / 52

Page 8: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Transport Layer Interface

Example: Consider the Berkeley socket interface, which has beenadopted by all UNIX systems, as well as Windows:

SOCKET Create a new communication endpointBIND Attach a local address to a socket

LISTEN Announce willingness to accept N connectionsACCEPT Block until someone remote wants to establish a connectionCONNECT Attempt to establish a connectionSEND Send data over a connectionRECEIVE Receive data over a connectionCLOSE Release the connection

The client and server each bind a transport-level address and a name to thelocally created socket.

The server must listen to its socket, thereby telling the kernel that it willsubsequently wait for connections from clients.After that, the server can accept or select connections from clients.The client connects to the socket.

it needs to provide the transport-level address by which it canlocate the server.

Now the client and server communicate through send/receive operations on theirrespective sockets.

also standard read / write operations can be usedCommunication ends when a connection is closed.

Paolo Costa 06 - Transport Layer Transport Service 4 / 52

Page 9: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Transport Layer Interface

Example: Consider the Berkeley socket interface, which has beenadopted by all UNIX systems, as well as Windows:

SOCKET Create a new communication endpointBIND Attach a local address to a socketLISTEN Announce willingness to accept N connections

ACCEPT Block until someone remote wants to establish a connectionCONNECT Attempt to establish a connectionSEND Send data over a connectionRECEIVE Receive data over a connectionCLOSE Release the connection

The client and server each bind a transport-level address and a name to thelocally created socket.The server must listen to its socket, thereby telling the kernel that it willsubsequently wait for connections from clients.

After that, the server can accept or select connections from clients.The client connects to the socket.

it needs to provide the transport-level address by which it canlocate the server.

Now the client and server communicate through send/receive operations on theirrespective sockets.

also standard read / write operations can be usedCommunication ends when a connection is closed.

Paolo Costa 06 - Transport Layer Transport Service 4 / 52

Page 10: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Transport Layer Interface

Example: Consider the Berkeley socket interface, which has beenadopted by all UNIX systems, as well as Windows:

SOCKET Create a new communication endpointBIND Attach a local address to a socketLISTEN Announce willingness to accept N connectionsACCEPT Block until someone remote wants to establish a connection

CONNECT Attempt to establish a connectionSEND Send data over a connectionRECEIVE Receive data over a connectionCLOSE Release the connection

The client and server each bind a transport-level address and a name to thelocally created socket.The server must listen to its socket, thereby telling the kernel that it willsubsequently wait for connections from clients.After that, the server can accept or select connections from clients.

The client connects to the socket.it needs to provide the transport-level address by which it canlocate the server.

Now the client and server communicate through send/receive operations on theirrespective sockets.

also standard read / write operations can be usedCommunication ends when a connection is closed.

Paolo Costa 06 - Transport Layer Transport Service 4 / 52

Page 11: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Transport Layer Interface

Example: Consider the Berkeley socket interface, which has beenadopted by all UNIX systems, as well as Windows:

SOCKET Create a new communication endpointBIND Attach a local address to a socketLISTEN Announce willingness to accept N connectionsACCEPT Block until someone remote wants to establish a connectionCONNECT Attempt to establish a connection

SEND Send data over a connectionRECEIVE Receive data over a connectionCLOSE Release the connection

The client and server each bind a transport-level address and a name to thelocally created socket.The server must listen to its socket, thereby telling the kernel that it willsubsequently wait for connections from clients.After that, the server can accept or select connections from clients.The client connects to the socket.

it needs to provide the transport-level address by which it canlocate the server.

Now the client and server communicate through send/receive operations on theirrespective sockets.

also standard read / write operations can be usedCommunication ends when a connection is closed.

Paolo Costa 06 - Transport Layer Transport Service 4 / 52

Page 12: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Transport Layer Interface

Example: Consider the Berkeley socket interface, which has beenadopted by all UNIX systems, as well as Windows:

SOCKET Create a new communication endpointBIND Attach a local address to a socketLISTEN Announce willingness to accept N connectionsACCEPT Block until someone remote wants to establish a connectionCONNECT Attempt to establish a connectionSEND Send data over a connectionRECEIVE Receive data over a connection

CLOSE Release the connection

The client and server each bind a transport-level address and a name to thelocally created socket.The server must listen to its socket, thereby telling the kernel that it willsubsequently wait for connections from clients.After that, the server can accept or select connections from clients.The client connects to the socket.

it needs to provide the transport-level address by which it canlocate the server.

Now the client and server communicate through send/receive operations on theirrespective sockets.

also standard read / write operations can be used

Communication ends when a connection is closed.

Paolo Costa 06 - Transport Layer Transport Service 4 / 52

Page 13: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Transport Layer Interface

Example: Consider the Berkeley socket interface, which has beenadopted by all UNIX systems, as well as Windows:

SOCKET Create a new communication endpointBIND Attach a local address to a socketLISTEN Announce willingness to accept N connectionsACCEPT Block until someone remote wants to establish a connectionCONNECT Attempt to establish a connectionSEND Send data over a connectionRECEIVE Receive data over a connectionCLOSE Release the connection

The client and server each bind a transport-level address and a name to thelocally created socket.The server must listen to its socket, thereby telling the kernel that it willsubsequently wait for connections from clients.After that, the server can accept or select connections from clients.The client connects to the socket.

it needs to provide the transport-level address by which it canlocate the server.

Now the client and server communicate through send/receive operations on theirrespective sockets.

also standard read / write operations can be usedCommunication ends when a connection is closed.Paolo Costa 06 - Transport Layer Transport Service 4 / 52

Page 14: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Connection-Oriented Socket Communication

socket()

bind()

listen()

accept()

socket()

connect()

write()read()

write()read()

close()close()

SERVER CLIENT

QuestionWhat about connectionless communication ? There is noconnection⇒ no need for listen, accept, and connect

Paolo Costa 06 - Transport Layer Transport Service 5 / 52

Page 15: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Connection-Oriented Socket Communication

socket()

bind()

listen()

accept()

socket()

connect()

write()read()

write()read()

close()close()

SERVER CLIENT

QuestionWhat about connectionless communication ?

There is noconnection⇒ no need for listen, accept, and connect

Paolo Costa 06 - Transport Layer Transport Service 5 / 52

Page 16: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Connection-Oriented Socket Communication

socket()

bind()

listen()

accept()

socket()

connect()

write()read()

write()read()

close()close()

SERVER CLIENT

QuestionWhat about connectionless communication ? There is noconnection⇒ no need for listen, accept, and connect

Paolo Costa 06 - Transport Layer Transport Service 5 / 52

Page 17: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

SocketsServer

1 public class Server {2 public static void main(String[] args) throws IOException {3 ServerSocket serverSocket = new ServerSocket(2008);4 System.out.println("Listening on port 2008...");56 while (true) {7 Socket socket = serverSocket.accept();89 BufferedReader in = new BufferedReader(

10 new InputStreamReader(socket.getInputStream()));11 PrintWriter out = new PrintWriter(12 new OutputStreamWriter(socket.getOutputStream()), true);1314 System.out.println(in.readLine());1516 out.println(System.console().readLine());1718 socket.close();19 }20 }21 }

Note

The ServerSocket constructor also implicitly binds the socket to the port

Sockets are read / write using the standard operations to access files

To handle multiple clients at the same time, a new thread must be created pereach new socket

Paolo Costa 06 - Transport Layer Transport Service 6 / 52

Page 18: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

SocketsServer

1 public class Server {2 public static void main(String[] args) throws IOException {3 ServerSocket serverSocket = new ServerSocket(2008);4 System.out.println("Listening on port 2008...");56 while (true) {7 Socket socket = serverSocket.accept();89 BufferedReader in = new BufferedReader(

10 new InputStreamReader(socket.getInputStream()));11 PrintWriter out = new PrintWriter(12 new OutputStreamWriter(socket.getOutputStream()), true);1314 System.out.println(in.readLine());1516 out.println(System.console().readLine());1718 socket.close();19 }20 }21 }

NoteThe ServerSocket constructor also implicitly binds the socket to the port

Sockets are read / write using the standard operations to access files

To handle multiple clients at the same time, a new thread must be created pereach new socket

Paolo Costa 06 - Transport Layer Transport Service 6 / 52

Page 19: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

SocketsServer

1 public class Server {2 public static void main(String[] args) throws IOException {3 ServerSocket serverSocket = new ServerSocket(2008);4 System.out.println("Listening on port 2008...");56 while (true) {7 Socket socket = serverSocket.accept();89 BufferedReader in = new BufferedReader(

10 new InputStreamReader(socket.getInputStream()));11 PrintWriter out = new PrintWriter(12 new OutputStreamWriter(socket.getOutputStream()), true);1314 System.out.println(in.readLine());1516 out.println(System.console().readLine());1718 socket.close();19 }20 }21 }

NoteThe ServerSocket constructor also implicitly binds the socket to the port

Sockets are read / write using the standard operations to access files

To handle multiple clients at the same time, a new thread must be created pereach new socket

Paolo Costa 06 - Transport Layer Transport Service 6 / 52

Page 20: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

SocketsServer

1 public class Server {2 public static void main(String[] args) throws IOException {3 ServerSocket serverSocket = new ServerSocket(2008);4 System.out.println("Listening on port 2008...");56 while (true) {7 Socket socket = serverSocket.accept();89 BufferedReader in = new BufferedReader(

10 new InputStreamReader(socket.getInputStream()));11 PrintWriter out = new PrintWriter(12 new OutputStreamWriter(socket.getOutputStream()), true);1314 System.out.println(in.readLine());1516 out.println(System.console().readLine());1718 socket.close();19 }20 }21 }

NoteThe ServerSocket constructor also implicitly binds the socket to the port

Sockets are read / write using the standard operations to access files

To handle multiple clients at the same time, a new thread must be created pereach new socket

Paolo Costa 06 - Transport Layer Transport Service 6 / 52

Page 21: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

SocketsClient

1 public class Client {2 public static void main(String[] args) throws UnknownHostException,3 IOException {4 Socket socket = new Socket("127.0.0.1", 2008);56 BufferedReader in = new BufferedReader(7 new InputStreamReader(socket.getInputStream()));8 PrintWriter out = new PrintWriter(9 new OutputStreamWriter(socket.getOutputStream()), true);

1011 out.println(System.console().readLine());1213 System.out.println(in.readLine());1415 }1617 }

Note

The Socket constructor also implicitly connects the socket to the IP address andport specified

Sockets are read / write using the standard operations to access files

Paolo Costa 06 - Transport Layer Transport Service 7 / 52

Page 22: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

SocketsClient

1 public class Client {2 public static void main(String[] args) throws UnknownHostException,3 IOException {4 Socket socket = new Socket("127.0.0.1", 2008);56 BufferedReader in = new BufferedReader(7 new InputStreamReader(socket.getInputStream()));8 PrintWriter out = new PrintWriter(9 new OutputStreamWriter(socket.getOutputStream()), true);

1011 out.println(System.console().readLine());1213 System.out.println(in.readLine());1415 }1617 }

NoteThe Socket constructor also implicitly connects the socket to the IP address andport specified

Sockets are read / write using the standard operations to access files

Paolo Costa 06 - Transport Layer Transport Service 7 / 52

Page 23: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

SocketsClient

1 public class Client {2 public static void main(String[] args) throws UnknownHostException,3 IOException {4 Socket socket = new Socket("127.0.0.1", 2008);56 BufferedReader in = new BufferedReader(7 new InputStreamReader(socket.getInputStream()));8 PrintWriter out = new PrintWriter(9 new OutputStreamWriter(socket.getOutputStream()), true);

1011 out.println(System.console().readLine());1213 System.out.println(in.readLine());1415 }1617 }

NoteThe Socket constructor also implicitly connects the socket to the IP address andport specified

Sockets are read / write using the standard operations to access files

Paolo Costa 06 - Transport Layer Transport Service 7 / 52

Page 24: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Observations

Messages sent by clients are encapsulated as transport protocoldata units (TPDUs) to the network layer:

A real hard part is establishing and releasing connections. Themodel can be either symmetric or asymmetric:

Symmetric: one side sends a disconnect request, and waits for theother to acknowledge that the connection is closed.

Yes, there are some problems with this model.In fact, it turns out it is impossible to implement.

Asymmetric: one side just closes the connection, and that’s it.Yes,it’s simple, but you may lose some data this way.Not really acceptable.

Paolo Costa 06 - Transport Layer Transport Service 8 / 52

Page 25: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Observations

Messages sent by clients are encapsulated as transport protocoldata units (TPDUs) to the network layer:

A real hard part is establishing and releasing connections. Themodel can be either symmetric or asymmetric:

Symmetric: one side sends a disconnect request, and waits for theother to acknowledge that the connection is closed.

Yes, there are some problems with this model.In fact, it turns out it is impossible to implement.

Asymmetric: one side just closes the connection, and that’s it.Yes,it’s simple, but you may lose some data this way.Not really acceptable.

Paolo Costa 06 - Transport Layer Transport Service 8 / 52

Page 26: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Observations

Messages sent by clients are encapsulated as transport protocoldata units (TPDUs) to the network layer:

A real hard part is establishing and releasing connections. Themodel can be either symmetric or asymmetric:

Symmetric: one side sends a disconnect request, and waits for theother to acknowledge that the connection is closed.

Yes, there are some problems with this model.In fact, it turns out it is impossible to implement.

Asymmetric: one side just closes the connection, and that’s it.Yes,it’s simple, but you may lose some data this way.Not really acceptable.

Paolo Costa 06 - Transport Layer Transport Service 8 / 52

Page 27: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Observations

Messages sent by clients are encapsulated as transport protocoldata units (TPDUs) to the network layer:

A real hard part is establishing and releasing connections. Themodel can be either symmetric or asymmetric:

Symmetric: one side sends a disconnect request, and waits for theother to acknowledge that the connection is closed.

Yes, there are some problems with this model.In fact, it turns out it is impossible to implement.

Asymmetric: one side just closes the connection, and that’s it.Yes,it’s simple, but you may lose some data this way.Not really acceptable.

Paolo Costa 06 - Transport Layer Transport Service 8 / 52

Page 28: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Observations

Messages sent by clients are encapsulated as transport protocoldata units (TPDUs) to the network layer:

A real hard part is establishing and releasing connections. Themodel can be either symmetric or asymmetric:

Symmetric: one side sends a disconnect request, and waits for theother to acknowledge that the connection is closed.

Yes, there are some problems with this model.In fact, it turns out it is impossible to implement.

Asymmetric: one side just closes the connection, and that’s it.Yes,it’s simple, but you may lose some data this way.Not really acceptable.

Paolo Costa 06 - Transport Layer Transport Service 8 / 52

Page 29: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Transport Protocol

Transport protocols strongly resemble those in the data link layere.g. lots of error and flow control

Big differences when it comes to solutions!

explicit addressingestablishing, maintaining, and releasing connectionsthe many connections require different solutions

e.g., packets can follow different paths and arrive with different delays

handle effects of subnet storage capabilities

Paolo Costa 06 - Transport Layer Transport Protocol Elements 9 / 52

Page 30: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Transport Protocol

Transport protocols strongly resemble those in the data link layere.g. lots of error and flow control

Big differences when it comes to solutions!

explicit addressingestablishing, maintaining, and releasing connectionsthe many connections require different solutions

e.g., packets can follow different paths and arrive with different delays

handle effects of subnet storage capabilities

Paolo Costa 06 - Transport Layer Transport Protocol Elements 9 / 52

Page 31: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Transport Protocol

Transport protocols strongly resemble those in the data link layere.g. lots of error and flow control

Big differences when it comes to solutions!

explicit addressing

establishing, maintaining, and releasing connectionsthe many connections require different solutions

e.g., packets can follow different paths and arrive with different delays

handle effects of subnet storage capabilities

Paolo Costa 06 - Transport Layer Transport Protocol Elements 9 / 52

Page 32: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Transport Protocol

Transport protocols strongly resemble those in the data link layere.g. lots of error and flow control

Big differences when it comes to solutions!

explicit addressingestablishing, maintaining, and releasing connections

the many connections require different solutions

e.g., packets can follow different paths and arrive with different delays

handle effects of subnet storage capabilities

Paolo Costa 06 - Transport Layer Transport Protocol Elements 9 / 52

Page 33: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Transport Protocol

Transport protocols strongly resemble those in the data link layere.g. lots of error and flow control

Big differences when it comes to solutions!

explicit addressingestablishing, maintaining, and releasing connectionsthe many connections require different solutions

e.g., packets can follow different paths and arrive with different delays

handle effects of subnet storage capabilities

Paolo Costa 06 - Transport Layer Transport Protocol Elements 9 / 52

Page 34: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Transport Protocol

Transport protocols strongly resemble those in the data link layere.g. lots of error and flow control

Big differences when it comes to solutions!

explicit addressingestablishing, maintaining, and releasing connectionsthe many connections require different solutions

e.g., packets can follow different paths and arrive with different delays

handle effects of subnet storage capabilities

Paolo Costa 06 - Transport Layer Transport Protocol Elements 9 / 52

Page 35: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Transport Protocol

Transport protocols strongly resemble those in the data link layere.g. lots of error and flow control

Big differences when it comes to solutions!

explicit addressingestablishing, maintaining, and releasing connectionsthe many connections require different solutions

e.g., packets can follow different paths and arrive with different delays

handle effects of subnet storage capabilities

Paolo Costa 06 - Transport Layer Transport Protocol Elements 9 / 52

Page 36: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Addressing

Each layer has its own way of dealing with addresses.In Internet, a transport service access point is an IP address witha port number.

QuestionHow do we get to know where the other party is? See next slide.

Paolo Costa 06 - Transport Layer Transport Protocol Elements 10 / 52

Page 37: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Addressing

Each layer has its own way of dealing with addresses.In Internet, a transport service access point is an IP address witha port number.

QuestionHow do we get to know where the other party is?

See next slide.

Paolo Costa 06 - Transport Layer Transport Protocol Elements 10 / 52

Page 38: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Addressing

Each layer has its own way of dealing with addresses.In Internet, a transport service access point is an IP address witha port number.

QuestionHow do we get to know where the other party is? See next slide.

Paolo Costa 06 - Transport Layer Transport Protocol Elements 10 / 52

Page 39: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Service LocationsFixed Addresses

Solution: have a single process, located at a well-known address,handle a large number of services

inetd in the UNIX world

Paolo Costa 06 - Transport Layer Transport Protocol Elements 11 / 52

Page 40: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Service LocationsFixed Addresses

Solution: have a single process, located at a well-known address,handle a large number of services

inetd in the UNIX world

Paolo Costa 06 - Transport Layer Transport Protocol Elements 11 / 52

Page 41: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Service LocationsUnknown Addresses

Problem: Sometimes you just can’t have a process handle allservices, e.g. because the service requires special hardware (fileserver)

⇒ find address of the server

Solution: you’ll have to use a name server.

QuestionGreat, so how do we find the name server? Fixed address :)

QuestionAt what level do you think name servers fit in? Really depends, generallyat the same level where the service is needed. E.g.,

DNS (network level)name server (transport level)application name server, e.g., Skype mapping nickname→ IP address(application level)

Paolo Costa 06 - Transport Layer Transport Protocol Elements 12 / 52

Page 42: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Service LocationsUnknown Addresses

Problem: Sometimes you just can’t have a process handle allservices, e.g. because the service requires special hardware (fileserver)

⇒ find address of the server

Solution: you’ll have to use a name server.

QuestionGreat, so how do we find the name server?

Fixed address :)

QuestionAt what level do you think name servers fit in? Really depends, generallyat the same level where the service is needed. E.g.,

DNS (network level)name server (transport level)application name server, e.g., Skype mapping nickname→ IP address(application level)

Paolo Costa 06 - Transport Layer Transport Protocol Elements 12 / 52

Page 43: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Service LocationsUnknown Addresses

Problem: Sometimes you just can’t have a process handle allservices, e.g. because the service requires special hardware (fileserver)

⇒ find address of the server

Solution: you’ll have to use a name server.

QuestionGreat, so how do we find the name server? Fixed address :)

QuestionAt what level do you think name servers fit in? Really depends, generallyat the same level where the service is needed. E.g.,

DNS (network level)name server (transport level)application name server, e.g., Skype mapping nickname→ IP address(application level)

Paolo Costa 06 - Transport Layer Transport Protocol Elements 12 / 52

Page 44: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Service LocationsUnknown Addresses

Problem: Sometimes you just can’t have a process handle allservices, e.g. because the service requires special hardware (fileserver)

⇒ find address of the server

Solution: you’ll have to use a name server.

QuestionGreat, so how do we find the name server? Fixed address :)

QuestionAt what level do you think name servers fit in?

Really depends, generallyat the same level where the service is needed. E.g.,

DNS (network level)name server (transport level)application name server, e.g., Skype mapping nickname→ IP address(application level)

Paolo Costa 06 - Transport Layer Transport Protocol Elements 12 / 52

Page 45: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Service LocationsUnknown Addresses

Problem: Sometimes you just can’t have a process handle allservices, e.g. because the service requires special hardware (fileserver)

⇒ find address of the server

Solution: you’ll have to use a name server.

QuestionGreat, so how do we find the name server? Fixed address :)

QuestionAt what level do you think name servers fit in? Really depends, generallyat the same level where the service is needed.

E.g.,

DNS (network level)name server (transport level)application name server, e.g., Skype mapping nickname→ IP address(application level)

Paolo Costa 06 - Transport Layer Transport Protocol Elements 12 / 52

Page 46: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Service LocationsUnknown Addresses

Problem: Sometimes you just can’t have a process handle allservices, e.g. because the service requires special hardware (fileserver)

⇒ find address of the server

Solution: you’ll have to use a name server.

QuestionGreat, so how do we find the name server? Fixed address :)

QuestionAt what level do you think name servers fit in? Really depends, generallyat the same level where the service is needed. E.g.,

DNS (network level)

name server (transport level)application name server, e.g., Skype mapping nickname→ IP address(application level)

Paolo Costa 06 - Transport Layer Transport Protocol Elements 12 / 52

Page 47: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Service LocationsUnknown Addresses

Problem: Sometimes you just can’t have a process handle allservices, e.g. because the service requires special hardware (fileserver)

⇒ find address of the server

Solution: you’ll have to use a name server.

QuestionGreat, so how do we find the name server? Fixed address :)

QuestionAt what level do you think name servers fit in? Really depends, generallyat the same level where the service is needed. E.g.,

DNS (network level)name server (transport level)

application name server, e.g., Skype mapping nickname→ IP address(application level)

Paolo Costa 06 - Transport Layer Transport Protocol Elements 12 / 52

Page 48: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Service LocationsUnknown Addresses

Problem: Sometimes you just can’t have a process handle allservices, e.g. because the service requires special hardware (fileserver)

⇒ find address of the server

Solution: you’ll have to use a name server.

QuestionGreat, so how do we find the name server? Fixed address :)

QuestionAt what level do you think name servers fit in? Really depends, generallyat the same level where the service is needed. E.g.,

DNS (network level)name server (transport level)application name server, e.g., Skype mapping nickname→ IP address(application level)

Paolo Costa 06 - Transport Layer Transport Protocol Elements 12 / 52

Page 49: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Connection Establishment

To establish a connection, you send off a connection request tothe other endThe other end then accepts the connection, and returns anacknowledgment.

Problem: Suppose you don’t get an answer, so you do anotherrequest.

(a) Your first request didn’t make it

⇒ no harm done

(b) The ack didn’t make it back

⇒ you’re establishing a second connection, but this can probably bedetected.

(c) Your first request didn’t make it yet

⇒ now you’re really making a second connection and no one knows youdidn’t do this on purpose.

QuestionWhy can (c) happen ? The network has storage capabilities, andunpredictable delays. This means that things can pop up out ofthe blue

Paolo Costa 06 - Transport Layer Transport Protocol Elements 13 / 52

Page 50: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Connection Establishment

To establish a connection, you send off a connection request tothe other endThe other end then accepts the connection, and returns anacknowledgment.Problem: Suppose you don’t get an answer, so you do anotherrequest.(a) Your first request didn’t make it

⇒ no harm done(b) The ack didn’t make it back

⇒ you’re establishing a second connection, but this can probably bedetected.

(c) Your first request didn’t make it yet

⇒ now you’re really making a second connection and no one knows youdidn’t do this on purpose.

QuestionWhy can (c) happen ? The network has storage capabilities, andunpredictable delays. This means that things can pop up out ofthe blue

Paolo Costa 06 - Transport Layer Transport Protocol Elements 13 / 52

Page 51: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Connection Establishment

To establish a connection, you send off a connection request tothe other endThe other end then accepts the connection, and returns anacknowledgment.Problem: Suppose you don’t get an answer, so you do anotherrequest.(a) Your first request didn’t make it

⇒ no harm done

(b) The ack didn’t make it back

⇒ you’re establishing a second connection, but this can probably bedetected.

(c) Your first request didn’t make it yet

⇒ now you’re really making a second connection and no one knows youdidn’t do this on purpose.

QuestionWhy can (c) happen ? The network has storage capabilities, andunpredictable delays. This means that things can pop up out ofthe blue

Paolo Costa 06 - Transport Layer Transport Protocol Elements 13 / 52

Page 52: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Connection Establishment

To establish a connection, you send off a connection request tothe other endThe other end then accepts the connection, and returns anacknowledgment.Problem: Suppose you don’t get an answer, so you do anotherrequest.(a) Your first request didn’t make it

⇒ no harm done(b) The ack didn’t make it back

⇒ you’re establishing a second connection, but this can probably bedetected.

(c) Your first request didn’t make it yet

⇒ now you’re really making a second connection and no one knows youdidn’t do this on purpose.

QuestionWhy can (c) happen ? The network has storage capabilities, andunpredictable delays. This means that things can pop up out ofthe blue

Paolo Costa 06 - Transport Layer Transport Protocol Elements 13 / 52

Page 53: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Connection Establishment

To establish a connection, you send off a connection request tothe other endThe other end then accepts the connection, and returns anacknowledgment.Problem: Suppose you don’t get an answer, so you do anotherrequest.(a) Your first request didn’t make it

⇒ no harm done(b) The ack didn’t make it back

⇒ you’re establishing a second connection, but this can probably bedetected.

(c) Your first request didn’t make it yet

⇒ now you’re really making a second connection and no one knows youdidn’t do this on purpose.

QuestionWhy can (c) happen ? The network has storage capabilities, andunpredictable delays. This means that things can pop up out ofthe blue

Paolo Costa 06 - Transport Layer Transport Protocol Elements 13 / 52

Page 54: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Connection Establishment

To establish a connection, you send off a connection request tothe other endThe other end then accepts the connection, and returns anacknowledgment.Problem: Suppose you don’t get an answer, so you do anotherrequest.(a) Your first request didn’t make it

⇒ no harm done(b) The ack didn’t make it back

⇒ you’re establishing a second connection, but this can probably bedetected.

(c) Your first request didn’t make it yet

⇒ now you’re really making a second connection and no one knows youdidn’t do this on purpose.

QuestionWhy can (c) happen ? The network has storage capabilities, andunpredictable delays. This means that things can pop up out ofthe blue

Paolo Costa 06 - Transport Layer Transport Protocol Elements 13 / 52

Page 55: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Connection Establishment

To establish a connection, you send off a connection request tothe other endThe other end then accepts the connection, and returns anacknowledgment.Problem: Suppose you don’t get an answer, so you do anotherrequest.(a) Your first request didn’t make it

⇒ no harm done(b) The ack didn’t make it back

⇒ you’re establishing a second connection, but this can probably bedetected.

(c) Your first request didn’t make it yet⇒ now you’re really making a second connection and no one knows you

didn’t do this on purpose.

QuestionWhy can (c) happen ? The network has storage capabilities, andunpredictable delays. This means that things can pop up out ofthe blue

Paolo Costa 06 - Transport Layer Transport Protocol Elements 13 / 52

Page 56: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Connection Establishment

To establish a connection, you send off a connection request tothe other endThe other end then accepts the connection, and returns anacknowledgment.Problem: Suppose you don’t get an answer, so you do anotherrequest.(a) Your first request didn’t make it

⇒ no harm done(b) The ack didn’t make it back

⇒ you’re establishing a second connection, but this can probably bedetected.

(c) Your first request didn’t make it yet⇒ now you’re really making a second connection and no one knows you

didn’t do this on purpose.

QuestionWhy can (c) happen ? The network has storage capabilities, andunpredictable delays. This means that things can pop up out ofthe blue

Paolo Costa 06 - Transport Layer Transport Protocol Elements 13 / 52

Page 57: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Connection Establishment

To establish a connection, you send off a connection request tothe other endThe other end then accepts the connection, and returns anacknowledgment.Problem: Suppose you don’t get an answer, so you do anotherrequest.(a) Your first request didn’t make it

⇒ no harm done(b) The ack didn’t make it back

⇒ you’re establishing a second connection, but this can probably bedetected.

(c) Your first request didn’t make it yet⇒ now you’re really making a second connection and no one knows you

didn’t do this on purpose.

QuestionWhy can (c) happen ?

The network has storage capabilities, andunpredictable delays. This means that things can pop up out ofthe blue

Paolo Costa 06 - Transport Layer Transport Protocol Elements 13 / 52

Page 58: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Connection Establishment

To establish a connection, you send off a connection request tothe other endThe other end then accepts the connection, and returns anacknowledgment.Problem: Suppose you don’t get an answer, so you do anotherrequest.(a) Your first request didn’t make it

⇒ no harm done(b) The ack didn’t make it back

⇒ you’re establishing a second connection, but this can probably bedetected.

(c) Your first request didn’t make it yet⇒ now you’re really making a second connection and no one knows you

didn’t do this on purpose.

QuestionWhy can (c) happen ? The network has storage capabilities, andunpredictable delays. This means that things can pop up out ofthe blue

Paolo Costa 06 - Transport Layer Transport Protocol Elements 13 / 52

Page 59: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Attacking Duplicates

Solution: Restrict the lifetime of TPDUsif the maximum lifetime is known in advance, we can be sure that aprevious packet is discarded and that it won’t interfere withsuccessive ones

Three possible solutions:(a) Restricted subnet design(b) Putting a hop counter in each packet(c) Timestamping each packet (requires global clock synchronization)

Basic idea: With packet lifetimes bounded, assign sequencenumbers to TPDUs, and let the sequence number space be solarge that no two outstanding TPDUs can have the same number.Problem #2: When a host crashes, it has to start numberingTPDUs again. So, where does it start?

You can’t just wait the maximum packet lifetime T and startcounting from the start again: in wide-area systems, T may be toolarge to do that.The point is that you must avoid that an initial sequence numbercorresponds to a TPDU still floating around.

⇒ So, just find the right initial number

Paolo Costa 06 - Transport Layer Transport Protocol Elements 14 / 52

Page 60: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Attacking Duplicates

Solution: Restrict the lifetime of TPDUsif the maximum lifetime is known in advance, we can be sure that aprevious packet is discarded and that it won’t interfere withsuccessive ones

Three possible solutions:(a) Restricted subnet design(b) Putting a hop counter in each packet(c) Timestamping each packet (requires global clock synchronization)

Basic idea: With packet lifetimes bounded, assign sequencenumbers to TPDUs, and let the sequence number space be solarge that no two outstanding TPDUs can have the same number.Problem #2: When a host crashes, it has to start numberingTPDUs again. So, where does it start?

You can’t just wait the maximum packet lifetime T and startcounting from the start again: in wide-area systems, T may be toolarge to do that.The point is that you must avoid that an initial sequence numbercorresponds to a TPDU still floating around.

⇒ So, just find the right initial number

Paolo Costa 06 - Transport Layer Transport Protocol Elements 14 / 52

Page 61: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Attacking Duplicates

Solution: Restrict the lifetime of TPDUsif the maximum lifetime is known in advance, we can be sure that aprevious packet is discarded and that it won’t interfere withsuccessive ones

Three possible solutions:(a) Restricted subnet design(b) Putting a hop counter in each packet(c) Timestamping each packet (requires global clock synchronization)

Basic idea: With packet lifetimes bounded, assign sequencenumbers to TPDUs, and let the sequence number space be solarge that no two outstanding TPDUs can have the same number.

Problem #2: When a host crashes, it has to start numberingTPDUs again. So, where does it start?

You can’t just wait the maximum packet lifetime T and startcounting from the start again: in wide-area systems, T may be toolarge to do that.The point is that you must avoid that an initial sequence numbercorresponds to a TPDU still floating around.

⇒ So, just find the right initial number

Paolo Costa 06 - Transport Layer Transport Protocol Elements 14 / 52

Page 62: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Attacking Duplicates

Solution: Restrict the lifetime of TPDUsif the maximum lifetime is known in advance, we can be sure that aprevious packet is discarded and that it won’t interfere withsuccessive ones

Three possible solutions:(a) Restricted subnet design(b) Putting a hop counter in each packet(c) Timestamping each packet (requires global clock synchronization)

Basic idea: With packet lifetimes bounded, assign sequencenumbers to TPDUs, and let the sequence number space be solarge that no two outstanding TPDUs can have the same number.Problem #2: When a host crashes, it has to start numberingTPDUs again. So, where does it start?

You can’t just wait the maximum packet lifetime T and startcounting from the start again: in wide-area systems, T may be toolarge to do that.The point is that you must avoid that an initial sequence numbercorresponds to a TPDU still floating around.

⇒ So, just find the right initial number

Paolo Costa 06 - Transport Layer Transport Protocol Elements 14 / 52

Page 63: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Attacking Duplicates

Solution: Restrict the lifetime of TPDUsif the maximum lifetime is known in advance, we can be sure that aprevious packet is discarded and that it won’t interfere withsuccessive ones

Three possible solutions:(a) Restricted subnet design(b) Putting a hop counter in each packet(c) Timestamping each packet (requires global clock synchronization)

Basic idea: With packet lifetimes bounded, assign sequencenumbers to TPDUs, and let the sequence number space be solarge that no two outstanding TPDUs can have the same number.Problem #2: When a host crashes, it has to start numberingTPDUs again. So, where does it start?

You can’t just wait the maximum packet lifetime T and startcounting from the start again: in wide-area systems, T may be toolarge to do that.The point is that you must avoid that an initial sequence numbercorresponds to a TPDU still floating around.

⇒ So, just find the right initial numberPaolo Costa 06 - Transport Layer Transport Protocol Elements 14 / 52

Page 64: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Forbidden Region

Solution: Assign sequence numbers in accordance to clock ticks,and assume that the clock continues ticking during a crash

when a connection is set up, the low-order k bits of the clock areused as the initial sequence number (also k bits)the clocks at different hosts need not be synchronized

This leads to a forbidden region:every time you want to assign a next sequence number, checkwhether that number is in the forbidden region.

Attention:

when sequence numbers are assigned at a lower pace than theclock ticks, we may enter the region “from the top.”likewise, assigning them too fast makes you enter the region “fromthe bottom”

Paolo Costa 06 - Transport Layer Transport Protocol Elements 15 / 52

Page 65: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Forbidden Region

Solution: Assign sequence numbers in accordance to clock ticks,and assume that the clock continues ticking during a crash

when a connection is set up, the low-order k bits of the clock areused as the initial sequence number (also k bits)the clocks at different hosts need not be synchronized

This leads to a forbidden region:every time you want to assign a next sequence number, checkwhether that number is in the forbidden region.

Attention:

when sequence numbers are assigned at a lower pace than theclock ticks, we may enter the region “from the top.”likewise, assigning them too fast makes you enter the region “fromthe bottom”

Paolo Costa 06 - Transport Layer Transport Protocol Elements 15 / 52

Page 66: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Forbidden Region

Solution: Assign sequence numbers in accordance to clock ticks,and assume that the clock continues ticking during a crash

when a connection is set up, the low-order k bits of the clock areused as the initial sequence number (also k bits)the clocks at different hosts need not be synchronized

This leads to a forbidden region:every time you want to assign a next sequence number, checkwhether that number is in the forbidden region.

Attention:when sequence numbers are assigned at a lower pace than theclock ticks, we may enter the region “from the top.”

likewise, assigning them too fast makes you enter the region “fromthe bottom”

’Paolo Costa 06 - Transport Layer Transport Protocol Elements 15 / 52

Page 67: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Forbidden Region

Solution: Assign sequence numbers in accordance to clock ticks,and assume that the clock continues ticking during a crash

when a connection is set up, the low-order k bits of the clock areused as the initial sequence number (also k bits)the clocks at different hosts need not be synchronized

This leads to a forbidden region:every time you want to assign a next sequence number, checkwhether that number is in the forbidden region.

Attention:when sequence numbers are assigned at a lower pace than theclock ticks, we may enter the region “from the top.”likewise, assigning them too fast makes you enter the region “fromthe bottom”

’Paolo Costa 06 - Transport Layer Transport Protocol Elements 15 / 52

Page 68: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Error-Free Connection Establishment

Problem: Great, we have a way of avoiding duplicates, but how dowe get a connection in the first place?One way or the other we have to get the sender and receiver toagree on initial sequence numbers.We need to avoid that an old (unnumbered) connection requestpops up.

Paolo Costa 06 - Transport Layer Transport Protocol Elements 16 / 52

Page 69: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Error-free Connection EstablishmentThree-way handshake

Solution: Three-way handshake.1. Host 1 chooses a sequence number, x, and sends a

CONNECTION REQUEST TPDU containing it to host 2.

2. Host 2 replies with an ACK TPDU acknowledging x and announcingits own initial sequence number, y.

3. Finally, host 1 acknowledges host 2’s choice of an initial sequencenumber in the first data TPDU that it sends

(a) Normal Operation

(b) Old duplicate CONNECTION REQUEST appearing out of nowhere

(c) Duplicate CONNECTION REQUEST and duplicate ACK

Paolo Costa 06 - Transport Layer Transport Protocol Elements 17 / 52

Page 70: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Error-free Connection EstablishmentThree-way handshake

Solution: Three-way handshake.1. Host 1 chooses a sequence number, x, and sends a

CONNECTION REQUEST TPDU containing it to host 2.2. Host 2 replies with an ACK TPDU acknowledging x and announcing

its own initial sequence number, y.

3. Finally, host 1 acknowledges host 2’s choice of an initial sequencenumber in the first data TPDU that it sends

(a) Normal Operation

(b) Old duplicate CONNECTION REQUEST appearing out of nowhere

(c) Duplicate CONNECTION REQUEST and duplicate ACK

Paolo Costa 06 - Transport Layer Transport Protocol Elements 17 / 52

Page 71: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Error-free Connection EstablishmentThree-way handshake

Solution: Three-way handshake.1. Host 1 chooses a sequence number, x, and sends a

CONNECTION REQUEST TPDU containing it to host 2.2. Host 2 replies with an ACK TPDU acknowledging x and announcing

its own initial sequence number, y.3. Finally, host 1 acknowledges host 2’s choice of an initial sequence

number in the first data TPDU that it sends

(a) Normal Operation

(b) Old duplicate CONNECTION REQUEST appearing out of nowhere

(c) Duplicate CONNECTION REQUEST and duplicate ACK

Paolo Costa 06 - Transport Layer Transport Protocol Elements 17 / 52

Page 72: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Error-free Connection EstablishmentThree-way handshake

Solution: Three-way handshake.1. Host 1 chooses a sequence number, x, and sends a

CONNECTION REQUEST TPDU containing it to host 2.2. Host 2 replies with an ACK TPDU acknowledging x and announcing

its own initial sequence number, y.3. Finally, host 1 acknowledges host 2’s choice of an initial sequence

number in the first data TPDU that it sends

(a) Normal Operation

(b) Old duplicate CONNECTION REQUEST appearing out of nowhere

(c) Duplicate CONNECTION REQUEST and duplicate ACK

Paolo Costa 06 - Transport Layer Transport Protocol Elements 17 / 52

Page 73: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Error-free Connection EstablishmentThree-way handshake

Solution: Three-way handshake.1. Host 1 chooses a sequence number, x, and sends a

CONNECTION REQUEST TPDU containing it to host 2.2. Host 2 replies with an ACK TPDU acknowledging x and announcing

its own initial sequence number, y.3. Finally, host 1 acknowledges host 2’s choice of an initial sequence

number in the first data TPDU that it sends

(a) Normal Operation

(b) Old duplicate CONNECTION REQUEST appearing out of nowhere

(c) Duplicate CONNECTION REQUEST and duplicate ACKPaolo Costa 06 - Transport Layer Transport Protocol Elements 17 / 52

Page 74: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Error-free Connection Release

There are two styles of terminating a connection: asymmetricrelease and symmetric release.

asymmetric release is the way the telephone system works: whenone party hangs up, the connection is brokensymmetric release treats the connection as two separateunidirectional connections and requires each one to be releasedseparately.

asymmetric release may result in loss of data:

Paolo Costa 06 - Transport Layer Transport Protocol Elements 18 / 52

Page 75: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Error-free Connection Release

There are two styles of terminating a connection: asymmetricrelease and symmetric release.

asymmetric release is the way the telephone system works: whenone party hangs up, the connection is brokensymmetric release treats the connection as two separateunidirectional connections and requires each one to be releasedseparately.

asymmetric release may result in loss of data:

Paolo Costa 06 - Transport Layer Transport Protocol Elements 18 / 52

Page 76: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Symmetric Connection ReleaseTwo-army Problem

Big problem: Can we devise a solution to release a connectionsuch that the two parties will always agree ?

⇒ the answer is simple: NO.

There is a famous problem that illustrates this issue. It is calledthe two-army problem

if either blue army attacks by itself, it will be defeated, but if the twoblue armies attack simultaneously, they will be victorious.their only communication medium is to send messengers into thevalley, where they might be captured and the message lost

It can be proven that no protocol to synchronize the attack existsneither of the two commanders can be certain that the other onehas received the message

Paolo Costa 06 - Transport Layer Transport Protocol Elements 19 / 52

Page 77: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Symmetric Connection ReleaseTwo-army Problem

Big problem: Can we devise a solution to release a connectionsuch that the two parties will always agree ?⇒ the answer is simple: NO.

There is a famous problem that illustrates this issue. It is calledthe two-army problem

if either blue army attacks by itself, it will be defeated, but if the twoblue armies attack simultaneously, they will be victorious.their only communication medium is to send messengers into thevalley, where they might be captured and the message lost

It can be proven that no protocol to synchronize the attack existsneither of the two commanders can be certain that the other onehas received the message

Paolo Costa 06 - Transport Layer Transport Protocol Elements 19 / 52

Page 78: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Symmetric Connection ReleaseTwo-army Problem

Big problem: Can we devise a solution to release a connectionsuch that the two parties will always agree ?⇒ the answer is simple: NO.

There is a famous problem that illustrates this issue. It is calledthe two-army problem

if either blue army attacks by itself, it will be defeated, but if the twoblue armies attack simultaneously, they will be victorious.their only communication medium is to send messengers into thevalley, where they might be captured and the message lost

It can be proven that no protocol to synchronize the attack existsneither of the two commanders can be certain that the other onehas received the message

Paolo Costa 06 - Transport Layer Transport Protocol Elements 19 / 52

Page 79: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Symmetric Connection ReleaseTwo-army Problem

Big problem: Can we devise a solution to release a connectionsuch that the two parties will always agree ?⇒ the answer is simple: NO.

There is a famous problem that illustrates this issue. It is calledthe two-army problem

if either blue army attacks by itself, it will be defeated, but if the twoblue armies attack simultaneously, they will be victorious.their only communication medium is to send messengers into thevalley, where they might be captured and the message lost

It can be proven that no protocol to synchronize the attack existsneither of the two commanders can be certain that the other onehas received the message

Paolo Costa 06 - Transport Layer Transport Protocol Elements 19 / 52

Page 80: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Symmetric Connection Release

To see the relevance of the two-army problem to releasingconnections, just substitute ”disconnect” for ”attack.”

if neither side is prepared to disconnect until it is convinced that theother side is prepared to disconnect too, the disconnection willnever happen.

Examples:

Normal case: Host 1 sends disconnect request (DR). Host 2responds with a DR. Host 1 acknowledges, and ACK arrives athost 2.ACK is lost: What should host 2 do? It doesn’t know for sure that itsDR came through.Host 2’s DR is lost: What should host 1 do? Of course, sendanother DR, but this brings us back to the normal case. This stillmeans that the ACK sent by host 1 may still get lost.

Pragmatic solution: Use timeout mechanismsthis will catch most cases, but it is never a fool-proof solutionthe initial DR and all retransmissions may still be lost, resulting in ahalf-open connection

Paolo Costa 06 - Transport Layer Transport Protocol Elements 20 / 52

Page 81: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Symmetric Connection Release

To see the relevance of the two-army problem to releasingconnections, just substitute ”disconnect” for ”attack.”

if neither side is prepared to disconnect until it is convinced that theother side is prepared to disconnect too, the disconnection willnever happen.

Examples:Normal case: Host 1 sends disconnect request (DR). Host 2responds with a DR. Host 1 acknowledges, and ACK arrives athost 2.

ACK is lost: What should host 2 do? It doesn’t know for sure that itsDR came through.Host 2’s DR is lost: What should host 1 do? Of course, sendanother DR, but this brings us back to the normal case. This stillmeans that the ACK sent by host 1 may still get lost.

Pragmatic solution: Use timeout mechanismsthis will catch most cases, but it is never a fool-proof solutionthe initial DR and all retransmissions may still be lost, resulting in ahalf-open connection

Paolo Costa 06 - Transport Layer Transport Protocol Elements 20 / 52

Page 82: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Symmetric Connection Release

To see the relevance of the two-army problem to releasingconnections, just substitute ”disconnect” for ”attack.”

if neither side is prepared to disconnect until it is convinced that theother side is prepared to disconnect too, the disconnection willnever happen.

Examples:Normal case: Host 1 sends disconnect request (DR). Host 2responds with a DR. Host 1 acknowledges, and ACK arrives athost 2.ACK is lost: What should host 2 do? It doesn’t know for sure that itsDR came through.

Host 2’s DR is lost: What should host 1 do? Of course, sendanother DR, but this brings us back to the normal case. This stillmeans that the ACK sent by host 1 may still get lost.

Pragmatic solution: Use timeout mechanismsthis will catch most cases, but it is never a fool-proof solutionthe initial DR and all retransmissions may still be lost, resulting in ahalf-open connection

Paolo Costa 06 - Transport Layer Transport Protocol Elements 20 / 52

Page 83: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Symmetric Connection Release

To see the relevance of the two-army problem to releasingconnections, just substitute ”disconnect” for ”attack.”

if neither side is prepared to disconnect until it is convinced that theother side is prepared to disconnect too, the disconnection willnever happen.

Examples:Normal case: Host 1 sends disconnect request (DR). Host 2responds with a DR. Host 1 acknowledges, and ACK arrives athost 2.ACK is lost: What should host 2 do? It doesn’t know for sure that itsDR came through.Host 2’s DR is lost: What should host 1 do? Of course, sendanother DR, but this brings us back to the normal case. This stillmeans that the ACK sent by host 1 may still get lost.

Pragmatic solution: Use timeout mechanismsthis will catch most cases, but it is never a fool-proof solutionthe initial DR and all retransmissions may still be lost, resulting in ahalf-open connection

Paolo Costa 06 - Transport Layer Transport Protocol Elements 20 / 52

Page 84: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Symmetric Connection Release

To see the relevance of the two-army problem to releasingconnections, just substitute ”disconnect” for ”attack.”

if neither side is prepared to disconnect until it is convinced that theother side is prepared to disconnect too, the disconnection willnever happen.

Examples:Normal case: Host 1 sends disconnect request (DR). Host 2responds with a DR. Host 1 acknowledges, and ACK arrives athost 2.ACK is lost: What should host 2 do? It doesn’t know for sure that itsDR came through.Host 2’s DR is lost: What should host 1 do? Of course, sendanother DR, but this brings us back to the normal case. This stillmeans that the ACK sent by host 1 may still get lost.

Pragmatic solution: Use timeout mechanismsthis will catch most cases, but it is never a fool-proof solutionthe initial DR and all retransmissions may still be lost, resulting in ahalf-open connection

Paolo Costa 06 - Transport Layer Transport Protocol Elements 20 / 52

Page 85: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Symmetric Connection Release

To see the relevance of the two-army problem to releasingconnections, just substitute ”disconnect” for ”attack.”

if neither side is prepared to disconnect until it is convinced that theother side is prepared to disconnect too, the disconnection willnever happen.

Examples:Normal case: Host 1 sends disconnect request (DR). Host 2responds with a DR. Host 1 acknowledges, and ACK arrives athost 2.ACK is lost: What should host 2 do? It doesn’t know for sure that itsDR came through.Host 2’s DR is lost: What should host 1 do? Of course, sendanother DR, but this brings us back to the normal case. This stillmeans that the ACK sent by host 1 may still get lost.

Pragmatic solution: Use timeout mechanismsthis will catch most cases, but it is never a fool-proof solutionthe initial DR and all retransmissions may still be lost, resulting in ahalf-open connection

Paolo Costa 06 - Transport Layer Transport Protocol Elements 20 / 52

Page 86: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Symmetric Connection ReleaseExample

(a) Normal Operation

(b) Final ACK lost(c) Response lost(d) Response lost and

subsequent DRs lost

Paolo Costa 06 - Transport Layer Transport Protocol Elements 21 / 52

Page 87: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Symmetric Connection ReleaseExample

(a) Normal Operation(b) Final ACK lost

(c) Response lost(d) Response lost and

subsequent DRs lost

Paolo Costa 06 - Transport Layer Transport Protocol Elements 21 / 52

Page 88: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Symmetric Connection ReleaseExample

(a) Normal Operation(b) Final ACK lost(c) Response lost

(d) Response lost andsubsequent DRs lost

Paolo Costa 06 - Transport Layer Transport Protocol Elements 21 / 52

Page 89: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Symmetric Connection ReleaseExample

(a) Normal Operation(b) Final ACK lost(c) Response lost(d) Response lost and

subsequent DRs lost

Paolo Costa 06 - Transport Layer Transport Protocol Elements 21 / 52

Page 90: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Flow Control and Buffering

Problem: Hosts may have so many connections that it becomesinfeasible to allocate a fixed number of buffers per connection toimplement a proper sliding window protocol

⇒ we need a dynamic buffer allocation scheme.

With an unreliable network, i.e. unreliable datagram serviceprovided by the network layer, the sender will have to bufferTPDUs until they are acknowledged.

the receiver may decide to drop incoming TPDUs if it has no bufferspace available.

With a reliable network, the sender will still have to buffer a TPDUuntil it is acknowledged

the network only acknowledges successful receipt, not delivery.Solution: the sender and receiver need to negotiate the number ofTPDUs that can be transmitted in sequence

because buffer space no longer comes for free.

Paolo Costa 06 - Transport Layer Transport Protocol Elements 22 / 52

Page 91: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Flow Control and Buffering

Problem: Hosts may have so many connections that it becomesinfeasible to allocate a fixed number of buffers per connection toimplement a proper sliding window protocol

⇒ we need a dynamic buffer allocation scheme.

With an unreliable network, i.e. unreliable datagram serviceprovided by the network layer, the sender will have to bufferTPDUs until they are acknowledged.

the receiver may decide to drop incoming TPDUs if it has no bufferspace available.

With a reliable network, the sender will still have to buffer a TPDUuntil it is acknowledged

the network only acknowledges successful receipt, not delivery.Solution: the sender and receiver need to negotiate the number ofTPDUs that can be transmitted in sequence

because buffer space no longer comes for free.

Paolo Costa 06 - Transport Layer Transport Protocol Elements 22 / 52

Page 92: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Flow Control and Buffering

Problem: Hosts may have so many connections that it becomesinfeasible to allocate a fixed number of buffers per connection toimplement a proper sliding window protocol

⇒ we need a dynamic buffer allocation scheme.

With an unreliable network, i.e. unreliable datagram serviceprovided by the network layer, the sender will have to bufferTPDUs until they are acknowledged.

the receiver may decide to drop incoming TPDUs if it has no bufferspace available.

With a reliable network, the sender will still have to buffer a TPDUuntil it is acknowledged

the network only acknowledges successful receipt, not delivery.Solution: the sender and receiver need to negotiate the number ofTPDUs that can be transmitted in sequence

because buffer space no longer comes for free.

Paolo Costa 06 - Transport Layer Transport Protocol Elements 22 / 52

Page 93: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Flow Control and Buffering

Problem: Hosts may have so many connections that it becomesinfeasible to allocate a fixed number of buffers per connection toimplement a proper sliding window protocol

⇒ we need a dynamic buffer allocation scheme.

With an unreliable network, i.e. unreliable datagram serviceprovided by the network layer, the sender will have to bufferTPDUs until they are acknowledged.

the receiver may decide to drop incoming TPDUs if it has no bufferspace available.

With a reliable network, the sender will still have to buffer a TPDUuntil it is acknowledged

the network only acknowledges successful receipt, not delivery.

Solution: the sender and receiver need to negotiate the number ofTPDUs that can be transmitted in sequence

because buffer space no longer comes for free.

Paolo Costa 06 - Transport Layer Transport Protocol Elements 22 / 52

Page 94: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Flow Control and Buffering

Problem: Hosts may have so many connections that it becomesinfeasible to allocate a fixed number of buffers per connection toimplement a proper sliding window protocol

⇒ we need a dynamic buffer allocation scheme.

With an unreliable network, i.e. unreliable datagram serviceprovided by the network layer, the sender will have to bufferTPDUs until they are acknowledged.

the receiver may decide to drop incoming TPDUs if it has no bufferspace available.

With a reliable network, the sender will still have to buffer a TPDUuntil it is acknowledged

the network only acknowledges successful receipt, not delivery.Solution: the sender and receiver need to negotiate the number ofTPDUs that can be transmitted in sequence

because buffer space no longer comes for free.

Paolo Costa 06 - Transport Layer Transport Protocol Elements 22 / 52

Page 95: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Buffer Reservation

The sender requests anumber of buffers at thereceiver’s side whenopening a connection.

The receiver respondswith a credit grant.After that, the receivergrants more creditwhen bufferspacebecomes available

QuestionWhat can we do aboutthe potential deadlock?

Just use yet anothertimer mechanism.

Paolo Costa 06 - Transport Layer Transport Protocol Elements 23 / 52

Page 96: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Buffer Reservation

The sender requests anumber of buffers at thereceiver’s side whenopening a connection.The receiver respondswith a credit grant.

After that, the receivergrants more creditwhen bufferspacebecomes available

QuestionWhat can we do aboutthe potential deadlock?

Just use yet anothertimer mechanism.

Paolo Costa 06 - Transport Layer Transport Protocol Elements 23 / 52

Page 97: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Buffer Reservation

The sender requests anumber of buffers at thereceiver’s side whenopening a connection.The receiver respondswith a credit grant.After that, the receivergrants more creditwhen bufferspacebecomes available

QuestionWhat can we do aboutthe potential deadlock?

Just use yet anothertimer mechanism.

Paolo Costa 06 - Transport Layer Transport Protocol Elements 23 / 52

Page 98: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Buffer Reservation

The sender requests anumber of buffers at thereceiver’s side whenopening a connection.The receiver respondswith a credit grant.After that, the receivergrants more creditwhen bufferspacebecomes available

QuestionWhat can we do aboutthe potential deadlock?

Just use yet anothertimer mechanism.

Paolo Costa 06 - Transport Layer Transport Protocol Elements 23 / 52

Page 99: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Buffer Reservation

The sender requests anumber of buffers at thereceiver’s side whenopening a connection.The receiver respondswith a credit grant.After that, the receivergrants more creditwhen bufferspacebecomes available

QuestionWhat can we do aboutthe potential deadlock?

Just use yet anothertimer mechanism.

Paolo Costa 06 - Transport Layer Transport Protocol Elements 23 / 52

Page 100: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Buffer Reservation

The sender requests anumber of buffers at thereceiver’s side whenopening a connection.The receiver respondswith a credit grant.After that, the receivergrants more creditwhen bufferspacebecomes available

QuestionWhat can we do aboutthe potential deadlock?

Just use yet anothertimer mechanism.

Paolo Costa 06 - Transport Layer Transport Protocol Elements 23 / 52

Page 101: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Buffer Reservation

The sender requests anumber of buffers at thereceiver’s side whenopening a connection.The receiver respondswith a credit grant.After that, the receivergrants more creditwhen bufferspacebecomes available

QuestionWhat can we do aboutthe potential deadlock?

Just use yet anothertimer mechanism.

Paolo Costa 06 - Transport Layer Transport Protocol Elements 23 / 52

Page 102: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Buffer Reservation

The sender requests anumber of buffers at thereceiver’s side whenopening a connection.The receiver respondswith a credit grant.After that, the receivergrants more creditwhen bufferspacebecomes available

QuestionWhat can we do aboutthe potential deadlock?

Just use yet anothertimer mechanism.

Paolo Costa 06 - Transport Layer Transport Protocol Elements 23 / 52

Page 103: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Buffer Reservation

The sender requests anumber of buffers at thereceiver’s side whenopening a connection.The receiver respondswith a credit grant.After that, the receivergrants more creditwhen bufferspacebecomes available

QuestionWhat can we do aboutthe potential deadlock?

Just use yet anothertimer mechanism.

Paolo Costa 06 - Transport Layer Transport Protocol Elements 23 / 52

Page 104: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Buffer Reservation

The sender requests anumber of buffers at thereceiver’s side whenopening a connection.The receiver respondswith a credit grant.After that, the receivergrants more creditwhen bufferspacebecomes available

QuestionWhat can we do aboutthe potential deadlock?

Just use yet anothertimer mechanism.

Paolo Costa 06 - Transport Layer Transport Protocol Elements 23 / 52

Page 105: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Buffer Reservation

The sender requests anumber of buffers at thereceiver’s side whenopening a connection.The receiver respondswith a credit grant.After that, the receivergrants more creditwhen bufferspacebecomes available

QuestionWhat can we do aboutthe potential deadlock?

Just use yet anothertimer mechanism.

Paolo Costa 06 - Transport Layer Transport Protocol Elements 23 / 52

Page 106: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Buffer Reservation

The sender requests anumber of buffers at thereceiver’s side whenopening a connection.The receiver respondswith a credit grant.After that, the receivergrants more creditwhen bufferspacebecomes available

QuestionWhat can we do aboutthe potential deadlock?

Just use yet anothertimer mechanism.

Paolo Costa 06 - Transport Layer Transport Protocol Elements 23 / 52

Page 107: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Buffer Reservation

The sender requests anumber of buffers at thereceiver’s side whenopening a connection.The receiver respondswith a credit grant.After that, the receivergrants more creditwhen bufferspacebecomes available

QuestionWhat can we do aboutthe potential deadlock?

Just use yet anothertimer mechanism.

Paolo Costa 06 - Transport Layer Transport Protocol Elements 23 / 52

Page 108: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Buffer Reservation

The sender requests anumber of buffers at thereceiver’s side whenopening a connection.The receiver respondswith a credit grant.After that, the receivergrants more creditwhen bufferspacebecomes available

QuestionWhat can we do aboutthe potential deadlock?

Just use yet anothertimer mechanism.

Paolo Costa 06 - Transport Layer Transport Protocol Elements 23 / 52

Page 109: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Buffer Reservation

The sender requests anumber of buffers at thereceiver’s side whenopening a connection.The receiver respondswith a credit grant.After that, the receivergrants more creditwhen bufferspacebecomes available

QuestionWhat can we do aboutthe potential deadlock?

Just use yet anothertimer mechanism.

Paolo Costa 06 - Transport Layer Transport Protocol Elements 23 / 52

Page 110: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Buffer Reservation

The sender requests anumber of buffers at thereceiver’s side whenopening a connection.The receiver respondswith a credit grant.After that, the receivergrants more creditwhen bufferspacebecomes available

QuestionWhat can we do aboutthe potential deadlock?

Just use yet anothertimer mechanism.

Paolo Costa 06 - Transport Layer Transport Protocol Elements 23 / 52

Page 111: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Buffer Reservation

The sender requests anumber of buffers at thereceiver’s side whenopening a connection.The receiver respondswith a credit grant.After that, the receivergrants more creditwhen bufferspacebecomes available

QuestionWhat can we do aboutthe potential deadlock?

Just use yet anothertimer mechanism.

Paolo Costa 06 - Transport Layer Transport Protocol Elements 23 / 52

Page 112: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Buffer Reservation

The sender requests anumber of buffers at thereceiver’s side whenopening a connection.The receiver respondswith a credit grant.After that, the receivergrants more creditwhen bufferspacebecomes available

QuestionWhat can we do aboutthe potential deadlock?

Just use yet anothertimer mechanism.

Paolo Costa 06 - Transport Layer Transport Protocol Elements 23 / 52

Page 113: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Buffer Reservation

The sender requests anumber of buffers at thereceiver’s side whenopening a connection.The receiver respondswith a credit grant.After that, the receivergrants more creditwhen bufferspacebecomes available

QuestionWhat can we do aboutthe potential deadlock?

Just use yet anothertimer mechanism.

Paolo Costa 06 - Transport Layer Transport Protocol Elements 23 / 52

Page 114: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Buffer Reservation

The sender requests anumber of buffers at thereceiver’s side whenopening a connection.The receiver respondswith a credit grant.After that, the receivergrants more creditwhen bufferspacebecomes available

QuestionWhat can we do aboutthe potential deadlock?

Just use yet anothertimer mechanism.

Paolo Costa 06 - Transport Layer Transport Protocol Elements 23 / 52

Page 115: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Buffer Reservation

The sender requests anumber of buffers at thereceiver’s side whenopening a connection.The receiver respondswith a credit grant.After that, the receivergrants more creditwhen bufferspacebecomes available

QuestionWhat can we do aboutthe potential deadlock?Just use yet anothertimer mechanism.

Paolo Costa 06 - Transport Layer Transport Protocol Elements 23 / 52

Page 116: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Flow ControlThe Network

As memory prices continue to fall dramatically, it may becomefeasible to equip hosts with so much memory that lack of buffers israrely, if ever, a problem.Problem: another bottleneck will appear: the carrying capacity ofthe subnet.

it may not be enough for what the sender and receiver want to do

If the network can handle c TPDUs per second, and takes a total ofr seconds to transmit, propagate, queue and process the TPDU,and to send an ACK, the sender need only maintain c · r buffersmore buffers is overkill for the network.

Solution: Let the sender estimate c and r and adjust its buffers.the carrying capacity can be determined by simply counting thenumber of TPDUs acknowledged during some time period and thendividing by the time period.

the sender should send as fast as it can, such that that the network’scarrying capacity, and not the low input rate, is limiting the ack rate

the time required for a transmitted TPDU to be acknowledged canbe measured exactly and a running mean maintained

Paolo Costa 06 - Transport Layer Transport Protocol Elements 24 / 52

Page 117: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Flow ControlThe Network

As memory prices continue to fall dramatically, it may becomefeasible to equip hosts with so much memory that lack of buffers israrely, if ever, a problem.Problem: another bottleneck will appear: the carrying capacity ofthe subnet.

it may not be enough for what the sender and receiver want to doIf the network can handle c TPDUs per second, and takes a total ofr seconds to transmit, propagate, queue and process the TPDU,and to send an ACK, the sender need only maintain c · r buffersmore buffers is overkill for the network.

Solution: Let the sender estimate c and r and adjust its buffers.the carrying capacity can be determined by simply counting thenumber of TPDUs acknowledged during some time period and thendividing by the time period.

the sender should send as fast as it can, such that that the network’scarrying capacity, and not the low input rate, is limiting the ack rate

the time required for a transmitted TPDU to be acknowledged canbe measured exactly and a running mean maintained

Paolo Costa 06 - Transport Layer Transport Protocol Elements 24 / 52

Page 118: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Flow ControlThe Network

As memory prices continue to fall dramatically, it may becomefeasible to equip hosts with so much memory that lack of buffers israrely, if ever, a problem.Problem: another bottleneck will appear: the carrying capacity ofthe subnet.

it may not be enough for what the sender and receiver want to doIf the network can handle c TPDUs per second, and takes a total ofr seconds to transmit, propagate, queue and process the TPDU,and to send an ACK, the sender need only maintain c · r buffersmore buffers is overkill for the network.

Solution: Let the sender estimate c and r and adjust its buffers.

the carrying capacity can be determined by simply counting thenumber of TPDUs acknowledged during some time period and thendividing by the time period.

the sender should send as fast as it can, such that that the network’scarrying capacity, and not the low input rate, is limiting the ack rate

the time required for a transmitted TPDU to be acknowledged canbe measured exactly and a running mean maintained

Paolo Costa 06 - Transport Layer Transport Protocol Elements 24 / 52

Page 119: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Flow ControlThe Network

As memory prices continue to fall dramatically, it may becomefeasible to equip hosts with so much memory that lack of buffers israrely, if ever, a problem.Problem: another bottleneck will appear: the carrying capacity ofthe subnet.

it may not be enough for what the sender and receiver want to doIf the network can handle c TPDUs per second, and takes a total ofr seconds to transmit, propagate, queue and process the TPDU,and to send an ACK, the sender need only maintain c · r buffersmore buffers is overkill for the network.

Solution: Let the sender estimate c and r and adjust its buffers.the carrying capacity can be determined by simply counting thenumber of TPDUs acknowledged during some time period and thendividing by the time period.

the sender should send as fast as it can, such that that the network’scarrying capacity, and not the low input rate, is limiting the ack rate

the time required for a transmitted TPDU to be acknowledged canbe measured exactly and a running mean maintained

Paolo Costa 06 - Transport Layer Transport Protocol Elements 24 / 52

Page 120: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Flow ControlThe Network

As memory prices continue to fall dramatically, it may becomefeasible to equip hosts with so much memory that lack of buffers israrely, if ever, a problem.Problem: another bottleneck will appear: the carrying capacity ofthe subnet.

it may not be enough for what the sender and receiver want to doIf the network can handle c TPDUs per second, and takes a total ofr seconds to transmit, propagate, queue and process the TPDU,and to send an ACK, the sender need only maintain c · r buffersmore buffers is overkill for the network.

Solution: Let the sender estimate c and r and adjust its buffers.the carrying capacity can be determined by simply counting thenumber of TPDUs acknowledged during some time period and thendividing by the time period.

the sender should send as fast as it can, such that that the network’scarrying capacity, and not the low input rate, is limiting the ack rate

the time required for a transmitted TPDU to be acknowledged canbe measured exactly and a running mean maintained

Paolo Costa 06 - Transport Layer Transport Protocol Elements 24 / 52

Page 121: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Multiplexing

(a) Upward MultiplexingAssume that the network offers only a limited number of virtualcircuits, or that a user doesn’t want to pay so much

⇒ use a single circuit for several connections(b) Downward Multiplexing

If a user requires a lot of bandwidth that cannot be supported by asingle network virtual circuit

⇒ use several circuits for a single connection

Paolo Costa 06 - Transport Layer Transport Protocol Elements 25 / 52

Page 122: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Multiplexing

(a) Upward MultiplexingAssume that the network offers only a limited number of virtualcircuits, or that a user doesn’t want to pay so much

⇒ use a single circuit for several connections

(b) Downward Multiplexing

If a user requires a lot of bandwidth that cannot be supported by asingle network virtual circuit

⇒ use several circuits for a single connection

Paolo Costa 06 - Transport Layer Transport Protocol Elements 25 / 52

Page 123: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Multiplexing

(a) Upward MultiplexingAssume that the network offers only a limited number of virtualcircuits, or that a user doesn’t want to pay so much

⇒ use a single circuit for several connections(b) Downward Multiplexing

If a user requires a lot of bandwidth that cannot be supported by asingle network virtual circuit

⇒ use several circuits for a single connection

Paolo Costa 06 - Transport Layer Transport Protocol Elements 25 / 52

Page 124: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Multiplexing

(a) Upward MultiplexingAssume that the network offers only a limited number of virtualcircuits, or that a user doesn’t want to pay so much

⇒ use a single circuit for several connections(b) Downward Multiplexing

If a user requires a lot of bandwidth that cannot be supported by asingle network virtual circuit

⇒ use several circuits for a single connectionPaolo Costa 06 - Transport Layer Transport Protocol Elements 25 / 52

Page 125: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Crash RecoveryProblem

Problem: A host responds to the receipt of a TPDU by performingan operation and returning an acknowledgment

how should the sending host respond when the receiving hostcrashes before, during, or after its response?

Situation:

assume the sender is informed that the receiver has just recoveredfrom a crash.should the sender retransmit the TPDU it just sent, or not?Distinguish between:

(a) S0: sender had no outstanding (unacknowledged) TPDUs(b) S1: sender had one outstanding TPDU

The receiving host may:

(a) first send ACK and then deliver the data to the application(b) first deliver the data to the application and then send ACK

Paolo Costa 06 - Transport Layer Transport Protocol Elements 26 / 52

Page 126: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Crash RecoveryProblem

Problem: A host responds to the receipt of a TPDU by performingan operation and returning an acknowledgment

how should the sending host respond when the receiving hostcrashes before, during, or after its response?

Situation:

assume the sender is informed that the receiver has just recoveredfrom a crash.should the sender retransmit the TPDU it just sent, or not?

Distinguish between:

(a) S0: sender had no outstanding (unacknowledged) TPDUs(b) S1: sender had one outstanding TPDU

The receiving host may:

(a) first send ACK and then deliver the data to the application(b) first deliver the data to the application and then send ACK

Paolo Costa 06 - Transport Layer Transport Protocol Elements 26 / 52

Page 127: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Crash RecoveryProblem

Problem: A host responds to the receipt of a TPDU by performingan operation and returning an acknowledgment

how should the sending host respond when the receiving hostcrashes before, during, or after its response?

Situation:

assume the sender is informed that the receiver has just recoveredfrom a crash.should the sender retransmit the TPDU it just sent, or not?Distinguish between:

(a) S0: sender had no outstanding (unacknowledged) TPDUs(b) S1: sender had one outstanding TPDU

The receiving host may:

(a) first send ACK and then deliver the data to the application(b) first deliver the data to the application and then send ACK

Paolo Costa 06 - Transport Layer Transport Protocol Elements 26 / 52

Page 128: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Crash RecoveryProblem

Problem: A host responds to the receipt of a TPDU by performingan operation and returning an acknowledgment

how should the sending host respond when the receiving hostcrashes before, during, or after its response?

Situation:

assume the sender is informed that the receiver has just recoveredfrom a crash.should the sender retransmit the TPDU it just sent, or not?Distinguish between:

(a) S0: sender had no outstanding (unacknowledged) TPDUs(b) S1: sender had one outstanding TPDU

The receiving host may:

(a) first send ACK and then deliver the data to the application(b) first deliver the data to the application and then send ACK

Paolo Costa 06 - Transport Layer Transport Protocol Elements 26 / 52

Page 129: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Crash RecoverySolution (?)

The sending host can employ four different strategies(a) Always retransmit(b) Never retransmit(c) Retransmit only in S0(d) Retransmit only in S1

Unfortunately none of this strategies works in all cases!Consider the following events

A: send ACKC: host crashesW: data written to the application

Paolo Costa 06 - Transport Layer Transport Protocol Elements 27 / 52

Page 130: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Crash RecoverySolution (?)

The sending host can employ four different strategies(a) Always retransmit(b) Never retransmit(c) Retransmit only in S0(d) Retransmit only in S1

Unfortunately none of this strategies works in all cases!Consider the following events

A: send ACKC: host crashesW: data written to the application

Paolo Costa 06 - Transport Layer Transport Protocol Elements 27 / 52

Page 131: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Example Protocol

Service PrimitivesLISTEN Block connection request comes inCONNECT Attempt to establish a connectionSEND Send data over a connectionRECEIVE Receive data over a connectionDISCONNECT Release the connection

Network Layer PacketsCALL REQUEST Sent to establish a connectionCALL ACCEPTED Response to CALL REQUESTCLEAR REQUEST Sent to release a connectionCLEAR CONFIRM Response to CLEAR CONNECTIONDATA Used to transport dataCREDIT For managing the window

State of a ConnectionIDLE Not yet establishedWAITING CONNECT called; CALL REQ. sentQUEUED CALL REQ. arrived; LISTEN not calledESTABLISHED Connection establishedSENDING Waiting for permission to send TPDURECEIVING RECEIVE has just been calledDISCONNECTING DISCONNECT has just been called

Paolo Costa 06 - Transport Layer Example Protocol 28 / 52

Page 132: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Example Protocol

Service PrimitivesLISTEN Block connection request comes inCONNECT Attempt to establish a connectionSEND Send data over a connectionRECEIVE Receive data over a connectionDISCONNECT Release the connection

Network Layer PacketsCALL REQUEST Sent to establish a connectionCALL ACCEPTED Response to CALL REQUESTCLEAR REQUEST Sent to release a connectionCLEAR CONFIRM Response to CLEAR CONNECTIONDATA Used to transport dataCREDIT For managing the window

State of a ConnectionIDLE Not yet establishedWAITING CONNECT called; CALL REQ. sentQUEUED CALL REQ. arrived; LISTEN not calledESTABLISHED Connection establishedSENDING Waiting for permission to send TPDURECEIVING RECEIVE has just been calledDISCONNECTING DISCONNECT has just been called

Paolo Costa 06 - Transport Layer Example Protocol 28 / 52

Page 133: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Example Protocol

Service PrimitivesLISTEN Block connection request comes inCONNECT Attempt to establish a connectionSEND Send data over a connectionRECEIVE Receive data over a connectionDISCONNECT Release the connection

Network Layer PacketsCALL REQUEST Sent to establish a connectionCALL ACCEPTED Response to CALL REQUESTCLEAR REQUEST Sent to release a connectionCLEAR CONFIRM Response to CLEAR CONNECTIONDATA Used to transport dataCREDIT For managing the window

State of a ConnectionIDLE Not yet establishedWAITING CONNECT called; CALL REQ. sentQUEUED CALL REQ. arrived; LISTEN not calledESTABLISHED Connection establishedSENDING Waiting for permission to send TPDURECEIVING RECEIVE has just been calledDISCONNECTING DISCONNECT has just been called

Paolo Costa 06 - Transport Layer Example Protocol 28 / 52

Page 134: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Example ProtocolFSM (Matrix)

It is useful to represent the state of a protocol as a finite statemachine

Paolo Costa 06 - Transport Layer Example Protocol 29 / 52

Page 135: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Example ProtocolFSM (Graph)

Alternative, a graph-based representation is used

Paolo Costa 06 - Transport Layer Example Protocol 30 / 52

Page 136: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

User Datagram Protocol (UDP)

The User Datagram Protocol (UDP) is essentially just atransport-level version of IP.

UDP is simple:no flow controlno error controlno retransmissions

UDP packets cannot be larger than 65 Kthat is the maximum IP packet size

QuestionSo why not use IP instead ? Because we still need the port fields todeliver the packet to the correct application

Paolo Costa 06 - Transport Layer UDP 31 / 52

Page 137: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

User Datagram Protocol (UDP)

The User Datagram Protocol (UDP) is essentially just atransport-level version of IP.

UDP is simple:no flow controlno error controlno retransmissions

UDP packets cannot be larger than 65 Kthat is the maximum IP packet size

QuestionSo why not use IP instead ?

Because we still need the port fields todeliver the packet to the correct application

Paolo Costa 06 - Transport Layer UDP 31 / 52

Page 138: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

User Datagram Protocol (UDP)

The User Datagram Protocol (UDP) is essentially just atransport-level version of IP.

UDP is simple:no flow controlno error controlno retransmissions

UDP packets cannot be larger than 65 Kthat is the maximum IP packet size

QuestionSo why not use IP instead ? Because we still need the port fields todeliver the packet to the correct application

Paolo Costa 06 - Transport Layer UDP 31 / 52

Page 139: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

User Datagram Protocol (UDP)Server

1 public class UDPServer {2 public static void main(String[] args) throws IOException {3 DatagramSocket socket = new DatagramSocket(2008);45 while (true) {6 byte buf[] = new byte[256];7 DatagramPacket packet = new DatagramPacket(buf, buf.length);89 socket.receive(packet);

10 String s = new String(packet.getData(), 0, packet.getLength());11 System.out.println(s);12 buf = System.console().readLine().getBytes();13 InetAddress clientAddress = packet.getAddress();14 int clientPort = packet.getPort();15 packet = new DatagramPacket(buf, buf.length, clientAddress,16 clientPort);17 socket.send(packet);18 }19 }20 }

NoteConnection-less protocol⇒ no need for listen / accept⇒ each datagram packet must carried the full address / port of the recipient

Paolo Costa 06 - Transport Layer UDP 32 / 52

Page 140: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

User Datagram Protocol (UDP)Server

1 public class UDPServer {2 public static void main(String[] args) throws IOException {3 DatagramSocket socket = new DatagramSocket(2008);45 while (true) {6 byte buf[] = new byte[256];7 DatagramPacket packet = new DatagramPacket(buf, buf.length);89 socket.receive(packet);

10 String s = new String(packet.getData(), 0, packet.getLength());11 System.out.println(s);12 buf = System.console().readLine().getBytes();13 InetAddress clientAddress = packet.getAddress();14 int clientPort = packet.getPort();15 packet = new DatagramPacket(buf, buf.length, clientAddress,16 clientPort);17 socket.send(packet);18 }19 }20 }

NoteConnection-less protocol⇒ no need for listen / accept⇒ each datagram packet must carried the full address / port of the recipient

Paolo Costa 06 - Transport Layer UDP 32 / 52

Page 141: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

User Datagram Protocol (UDP)Client

1 public class UDPClient {2 public static void main(String[] args) throws IOException {3 byte buf[] = System.console().readLine().getBytes();45 DatagramPacket packet = new DatagramPacket(buf, buf.length, InetAddress6 .getByName("127.0.0.1"), 2008);78 DatagramSocket socket = new DatagramSocket();9

10 socket.send(packet);1112 buf = new byte[256];1314 packet = new DatagramPacket(buf, buf.length);1516 socket.receive(packet);1718 System.out.println(new String(packet.getData()));19 }20 }

NoteConnection-less protocol⇒ no need for connect⇒ each datagram packet must carried the full address / port of the recipient

Paolo Costa 06 - Transport Layer UDP 33 / 52

Page 142: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

User Datagram Protocol (UDP)Client

1 public class UDPClient {2 public static void main(String[] args) throws IOException {3 byte buf[] = System.console().readLine().getBytes();45 DatagramPacket packet = new DatagramPacket(buf, buf.length, InetAddress6 .getByName("127.0.0.1"), 2008);78 DatagramSocket socket = new DatagramSocket();9

10 socket.send(packet);1112 buf = new byte[256];1314 packet = new DatagramPacket(buf, buf.length);1516 socket.receive(packet);1718 System.out.println(new String(packet.getData()));19 }20 }

NoteConnection-less protocol⇒ no need for connect⇒ each datagram packet must carried the full address / port of the recipient

Paolo Costa 06 - Transport Layer UDP 33 / 52

Page 143: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

User Datagram Protocol (UDP)When shall we use it ?

A typical question is why people should ever use UDP (instead ofTCP) since it does not provide any reliability nor flow controlHere are some reasons

1. finer application-level control over what data is sent and when (e.g.,real-time, skype)

2. no connection establishment3. no connection state4. small packet header overhead

Beside real-time apps, one area where UDP is really useful is inclient-server situations

Often, the client sends a short request to the server and expects ashort reply back.if either the request or reply is lost, the client can just time out andtry again.

⇒ simpler code and fewer messages requirede.g., DNS query: symbolic address (e.g., www.cs.vu.nl)→ IPaddress translation (e.g., 130.37.20.20)

Paolo Costa 06 - Transport Layer UDP 34 / 52

Page 144: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

User Datagram Protocol (UDP)When shall we use it ?

A typical question is why people should ever use UDP (instead ofTCP) since it does not provide any reliability nor flow controlHere are some reasons

1. finer application-level control over what data is sent and when (e.g.,real-time, skype)

2. no connection establishment

3. no connection state4. small packet header overhead

Beside real-time apps, one area where UDP is really useful is inclient-server situations

Often, the client sends a short request to the server and expects ashort reply back.if either the request or reply is lost, the client can just time out andtry again.

⇒ simpler code and fewer messages requirede.g., DNS query: symbolic address (e.g., www.cs.vu.nl)→ IPaddress translation (e.g., 130.37.20.20)

Paolo Costa 06 - Transport Layer UDP 34 / 52

Page 145: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

User Datagram Protocol (UDP)When shall we use it ?

A typical question is why people should ever use UDP (instead ofTCP) since it does not provide any reliability nor flow controlHere are some reasons

1. finer application-level control over what data is sent and when (e.g.,real-time, skype)

2. no connection establishment3. no connection state

4. small packet header overheadBeside real-time apps, one area where UDP is really useful is inclient-server situations

Often, the client sends a short request to the server and expects ashort reply back.if either the request or reply is lost, the client can just time out andtry again.

⇒ simpler code and fewer messages requirede.g., DNS query: symbolic address (e.g., www.cs.vu.nl)→ IPaddress translation (e.g., 130.37.20.20)

Paolo Costa 06 - Transport Layer UDP 34 / 52

Page 146: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

User Datagram Protocol (UDP)When shall we use it ?

A typical question is why people should ever use UDP (instead ofTCP) since it does not provide any reliability nor flow controlHere are some reasons

1. finer application-level control over what data is sent and when (e.g.,real-time, skype)

2. no connection establishment3. no connection state4. small packet header overhead

Beside real-time apps, one area where UDP is really useful is inclient-server situations

Often, the client sends a short request to the server and expects ashort reply back.if either the request or reply is lost, the client can just time out andtry again.

⇒ simpler code and fewer messages requirede.g., DNS query: symbolic address (e.g., www.cs.vu.nl)→ IPaddress translation (e.g., 130.37.20.20)

Paolo Costa 06 - Transport Layer UDP 34 / 52

Page 147: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

User Datagram Protocol (UDP)When shall we use it ?

A typical question is why people should ever use UDP (instead ofTCP) since it does not provide any reliability nor flow controlHere are some reasons

1. finer application-level control over what data is sent and when (e.g.,real-time, skype)

2. no connection establishment3. no connection state4. small packet header overhead

Beside real-time apps, one area where UDP is really useful is inclient-server situations

Often, the client sends a short request to the server and expects ashort reply back.if either the request or reply is lost, the client can just time out andtry again.

⇒ simpler code and fewer messages requirede.g., DNS query: symbolic address (e.g., www.cs.vu.nl)→ IPaddress translation (e.g., 130.37.20.20)

Paolo Costa 06 - Transport Layer UDP 34 / 52

Page 148: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

User Datagram Protocol (UDP)When shall we use it ?

A typical question is why people should ever use UDP (instead ofTCP) since it does not provide any reliability nor flow controlHere are some reasons

1. finer application-level control over what data is sent and when (e.g.,real-time, skype)

2. no connection establishment3. no connection state4. small packet header overhead

Beside real-time apps, one area where UDP is really useful is inclient-server situations

Often, the client sends a short request to the server and expects ashort reply back.

if either the request or reply is lost, the client can just time out andtry again.

⇒ simpler code and fewer messages requirede.g., DNS query: symbolic address (e.g., www.cs.vu.nl)→ IPaddress translation (e.g., 130.37.20.20)

Paolo Costa 06 - Transport Layer UDP 34 / 52

Page 149: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

User Datagram Protocol (UDP)When shall we use it ?

A typical question is why people should ever use UDP (instead ofTCP) since it does not provide any reliability nor flow controlHere are some reasons

1. finer application-level control over what data is sent and when (e.g.,real-time, skype)

2. no connection establishment3. no connection state4. small packet header overhead

Beside real-time apps, one area where UDP is really useful is inclient-server situations

Often, the client sends a short request to the server and expects ashort reply back.if either the request or reply is lost, the client can just time out andtry again.

⇒ simpler code and fewer messages requirede.g., DNS query: symbolic address (e.g., www.cs.vu.nl)→ IPaddress translation (e.g., 130.37.20.20)

Paolo Costa 06 - Transport Layer UDP 34 / 52

Page 150: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

User Datagram Protocol (UDP)When shall we use it ?

A typical question is why people should ever use UDP (instead ofTCP) since it does not provide any reliability nor flow controlHere are some reasons

1. finer application-level control over what data is sent and when (e.g.,real-time, skype)

2. no connection establishment3. no connection state4. small packet header overhead

Beside real-time apps, one area where UDP is really useful is inclient-server situations

Often, the client sends a short request to the server and expects ashort reply back.if either the request or reply is lost, the client can just time out andtry again.

⇒ simpler code and fewer messages required

e.g., DNS query: symbolic address (e.g., www.cs.vu.nl)→ IPaddress translation (e.g., 130.37.20.20)

Paolo Costa 06 - Transport Layer UDP 34 / 52

Page 151: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

User Datagram Protocol (UDP)When shall we use it ?

A typical question is why people should ever use UDP (instead ofTCP) since it does not provide any reliability nor flow controlHere are some reasons

1. finer application-level control over what data is sent and when (e.g.,real-time, skype)

2. no connection establishment3. no connection state4. small packet header overhead

Beside real-time apps, one area where UDP is really useful is inclient-server situations

Often, the client sends a short request to the server and expects ashort reply back.if either the request or reply is lost, the client can just time out andtry again.

⇒ simpler code and fewer messages requirede.g., DNS query: symbolic address (e.g., www.cs.vu.nl)→ IPaddress translation (e.g., 130.37.20.20)

Paolo Costa 06 - Transport Layer UDP 34 / 52

Page 152: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Remote Procedure Call (RPC)

UDP is also used by the Remote Procedure Call (RPC)a client-server communication in which a procedure is madeavailable to remote clientthe call (including its parameters) is shipped to the server

1. Client calls the procedure at a local stub2. Client stub marshalls request: it puts everything into a (UDP) message3. The message is transferred over the network4. The server stub unmarshalls the message...5. ... and calls the local implementation of the procedure.

RMI (Remote Method Invocation) is the Java version of RPC

QuestionWhat’s the difficulty with RPCs? Mainly pointers and global variables

Paolo Costa 06 - Transport Layer UDP 35 / 52

Page 153: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Remote Procedure Call (RPC)

UDP is also used by the Remote Procedure Call (RPC)a client-server communication in which a procedure is madeavailable to remote clientthe call (including its parameters) is shipped to the server

1. Client calls the procedure at a local stub

2. Client stub marshalls request: it puts everything into a (UDP) message3. The message is transferred over the network4. The server stub unmarshalls the message...5. ... and calls the local implementation of the procedure.

RMI (Remote Method Invocation) is the Java version of RPC

QuestionWhat’s the difficulty with RPCs? Mainly pointers and global variables

Paolo Costa 06 - Transport Layer UDP 35 / 52

Page 154: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Remote Procedure Call (RPC)

UDP is also used by the Remote Procedure Call (RPC)a client-server communication in which a procedure is madeavailable to remote clientthe call (including its parameters) is shipped to the server

1. Client calls the procedure at a local stub2. Client stub marshalls request: it puts everything into a (UDP) message

3. The message is transferred over the network4. The server stub unmarshalls the message...5. ... and calls the local implementation of the procedure.

RMI (Remote Method Invocation) is the Java version of RPC

QuestionWhat’s the difficulty with RPCs? Mainly pointers and global variables

Paolo Costa 06 - Transport Layer UDP 35 / 52

Page 155: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Remote Procedure Call (RPC)

UDP is also used by the Remote Procedure Call (RPC)a client-server communication in which a procedure is madeavailable to remote clientthe call (including its parameters) is shipped to the server

1. Client calls the procedure at a local stub2. Client stub marshalls request: it puts everything into a (UDP) message3. The message is transferred over the network

4. The server stub unmarshalls the message...5. ... and calls the local implementation of the procedure.

RMI (Remote Method Invocation) is the Java version of RPC

QuestionWhat’s the difficulty with RPCs? Mainly pointers and global variables

Paolo Costa 06 - Transport Layer UDP 35 / 52

Page 156: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Remote Procedure Call (RPC)

UDP is also used by the Remote Procedure Call (RPC)a client-server communication in which a procedure is madeavailable to remote clientthe call (including its parameters) is shipped to the server

1. Client calls the procedure at a local stub2. Client stub marshalls request: it puts everything into a (UDP) message3. The message is transferred over the network4. The server stub unmarshalls the message...

5. ... and calls the local implementation of the procedure.

RMI (Remote Method Invocation) is the Java version of RPC

QuestionWhat’s the difficulty with RPCs? Mainly pointers and global variables

Paolo Costa 06 - Transport Layer UDP 35 / 52

Page 157: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Remote Procedure Call (RPC)

UDP is also used by the Remote Procedure Call (RPC)a client-server communication in which a procedure is madeavailable to remote clientthe call (including its parameters) is shipped to the server

1. Client calls the procedure at a local stub2. Client stub marshalls request: it puts everything into a (UDP) message3. The message is transferred over the network4. The server stub unmarshalls the message...5. ... and calls the local implementation of the procedure.

RMI (Remote Method Invocation) is the Java version of RPC

QuestionWhat’s the difficulty with RPCs? Mainly pointers and global variables

Paolo Costa 06 - Transport Layer UDP 35 / 52

Page 158: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Remote Procedure Call (RPC)

UDP is also used by the Remote Procedure Call (RPC)a client-server communication in which a procedure is madeavailable to remote clientthe call (including its parameters) is shipped to the server

1. Client calls the procedure at a local stub2. Client stub marshalls request: it puts everything into a (UDP) message3. The message is transferred over the network4. The server stub unmarshalls the message...5. ... and calls the local implementation of the procedure.

RMI (Remote Method Invocation) is the Java version of RPC

QuestionWhat’s the difficulty with RPCs? Mainly pointers and global variables

Paolo Costa 06 - Transport Layer UDP 35 / 52

Page 159: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Remote Procedure Call (RPC)

UDP is also used by the Remote Procedure Call (RPC)a client-server communication in which a procedure is madeavailable to remote clientthe call (including its parameters) is shipped to the server

1. Client calls the procedure at a local stub2. Client stub marshalls request: it puts everything into a (UDP) message3. The message is transferred over the network4. The server stub unmarshalls the message...5. ... and calls the local implementation of the procedure.

RMI (Remote Method Invocation) is the Java version of RPC

QuestionWhat’s the difficulty with RPCs?

Mainly pointers and global variables

Paolo Costa 06 - Transport Layer UDP 35 / 52

Page 160: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Remote Procedure Call (RPC)

UDP is also used by the Remote Procedure Call (RPC)a client-server communication in which a procedure is madeavailable to remote clientthe call (including its parameters) is shipped to the server

1. Client calls the procedure at a local stub2. Client stub marshalls request: it puts everything into a (UDP) message3. The message is transferred over the network4. The server stub unmarshalls the message...5. ... and calls the local implementation of the procedure.

RMI (Remote Method Invocation) is the Java version of RPC

QuestionWhat’s the difficulty with RPCs? Mainly pointers and global variables

Paolo Costa 06 - Transport Layer UDP 35 / 52

Page 161: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Real Time Protocol (RTP)

Problem: Can we support multimedia streaming over the Internet?

Solution The Real-Time Transport Protocol provides somebest-effort support.

RTP essentially just multiplexes a number of multimedia streamsinto a single UDP stream .The receiver is responsible for compensating missing packets

highly application dependent (e.g., through interpolation)RTP packets can be timestamped:

packets belonging to the same substream can receive a timestampindicating how far off they are with respect to their predecessor.this approach allows the system to reduce jitter.in addition, timestamps can be used to synchronize multiplesubstreams (e.g., video with two audio channels)

Paolo Costa 06 - Transport Layer UDP 36 / 52

Page 162: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Real Time Protocol (RTP)

Problem: Can we support multimedia streaming over the Internet?Solution The Real-Time Transport Protocol provides somebest-effort support.

RTP essentially just multiplexes a number of multimedia streamsinto a single UDP stream

.The receiver is responsible for compensating missing packets

highly application dependent (e.g., through interpolation)RTP packets can be timestamped:

packets belonging to the same substream can receive a timestampindicating how far off they are with respect to their predecessor.this approach allows the system to reduce jitter.in addition, timestamps can be used to synchronize multiplesubstreams (e.g., video with two audio channels)

Paolo Costa 06 - Transport Layer UDP 36 / 52

Page 163: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Real Time Protocol (RTP)

Problem: Can we support multimedia streaming over the Internet?Solution The Real-Time Transport Protocol provides somebest-effort support.

RTP essentially just multiplexes a number of multimedia streamsinto a single UDP stream .The receiver is responsible for compensating missing packets

highly application dependent (e.g., through interpolation)

RTP packets can be timestamped:packets belonging to the same substream can receive a timestampindicating how far off they are with respect to their predecessor.this approach allows the system to reduce jitter.in addition, timestamps can be used to synchronize multiplesubstreams (e.g., video with two audio channels)

Paolo Costa 06 - Transport Layer UDP 36 / 52

Page 164: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Real Time Protocol (RTP)

Problem: Can we support multimedia streaming over the Internet?Solution The Real-Time Transport Protocol provides somebest-effort support.

RTP essentially just multiplexes a number of multimedia streamsinto a single UDP stream .The receiver is responsible for compensating missing packets

highly application dependent (e.g., through interpolation)RTP packets can be timestamped:

packets belonging to the same substream can receive a timestampindicating how far off they are with respect to their predecessor.this approach allows the system to reduce jitter.

in addition, timestamps can be used to synchronize multiplesubstreams (e.g., video with two audio channels)

Paolo Costa 06 - Transport Layer UDP 36 / 52

Page 165: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Real Time Protocol (RTP)

Problem: Can we support multimedia streaming over the Internet?Solution The Real-Time Transport Protocol provides somebest-effort support.

RTP essentially just multiplexes a number of multimedia streamsinto a single UDP stream .The receiver is responsible for compensating missing packets

highly application dependent (e.g., through interpolation)RTP packets can be timestamped:

packets belonging to the same substream can receive a timestampindicating how far off they are with respect to their predecessor.this approach allows the system to reduce jitter.in addition, timestamps can be used to synchronize multiplesubstreams (e.g., video with two audio channels)

Paolo Costa 06 - Transport Layer UDP 36 / 52

Page 166: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Transmission Control Protocol (TCP)

Connection-oriented service that supports byte streams (notmessage streams)

a sender may send eight 512-byte packets that are received as twochunks of 1024 bytes, and one of 2048 bytes.

Transport address consists of a 16-bit port number, whichaugments the underlying IP address.TCP ensures reliable, point–to–point connections

No support for multicasting or broadcasting.

A TCP TPDU is called a segment, consisting of (minimal) 20-byteheader, and maximum total length of 65,535 bytes.

a segment is fragmented by the network layer when it is larger thanthe network’s maximum transfer unit (MTU).

Paolo Costa 06 - Transport Layer TCP 37 / 52

Page 167: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Transmission Control Protocol (TCP)

Connection-oriented service that supports byte streams (notmessage streams)

a sender may send eight 512-byte packets that are received as twochunks of 1024 bytes, and one of 2048 bytes.

Transport address consists of a 16-bit port number, whichaugments the underlying IP address.TCP ensures reliable, point–to–point connections

No support for multicasting or broadcasting.

A TCP TPDU is called a segment, consisting of (minimal) 20-byteheader, and maximum total length of 65,535 bytes.

a segment is fragmented by the network layer when it is larger thanthe network’s maximum transfer unit (MTU).

Paolo Costa 06 - Transport Layer TCP 37 / 52

Page 168: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Transmission Control Protocol (TCP)

Connection-oriented service that supports byte streams (notmessage streams)

a sender may send eight 512-byte packets that are received as twochunks of 1024 bytes, and one of 2048 bytes.

Transport address consists of a 16-bit port number, whichaugments the underlying IP address.

TCP ensures reliable, point–to–point connections

No support for multicasting or broadcasting.

A TCP TPDU is called a segment, consisting of (minimal) 20-byteheader, and maximum total length of 65,535 bytes.

a segment is fragmented by the network layer when it is larger thanthe network’s maximum transfer unit (MTU).

Paolo Costa 06 - Transport Layer TCP 37 / 52

Page 169: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Transmission Control Protocol (TCP)

Connection-oriented service that supports byte streams (notmessage streams)

a sender may send eight 512-byte packets that are received as twochunks of 1024 bytes, and one of 2048 bytes.

Transport address consists of a 16-bit port number, whichaugments the underlying IP address.TCP ensures reliable, point–to–point connections

No support for multicasting or broadcasting.A TCP TPDU is called a segment, consisting of (minimal) 20-byteheader, and maximum total length of 65,535 bytes.

a segment is fragmented by the network layer when it is larger thanthe network’s maximum transfer unit (MTU).

Paolo Costa 06 - Transport Layer TCP 37 / 52

Page 170: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Transmission Control Protocol (TCP)

Connection-oriented service that supports byte streams (notmessage streams)

a sender may send eight 512-byte packets that are received as twochunks of 1024 bytes, and one of 2048 bytes.

Transport address consists of a 16-bit port number, whichaugments the underlying IP address.TCP ensures reliable, point–to–point connections

No support for multicasting or broadcasting.

A TCP TPDU is called a segment, consisting of (minimal) 20-byteheader, and maximum total length of 65,535 bytes.

a segment is fragmented by the network layer when it is larger thanthe network’s maximum transfer unit (MTU).

Paolo Costa 06 - Transport Layer TCP 37 / 52

Page 171: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Transmission Control Protocol (TCP)

Connection-oriented service that supports byte streams (notmessage streams)

a sender may send eight 512-byte packets that are received as twochunks of 1024 bytes, and one of 2048 bytes.

Transport address consists of a 16-bit port number, whichaugments the underlying IP address.TCP ensures reliable, point–to–point connections

No support for multicasting or broadcasting.A TCP TPDU is called a segment, consisting of (minimal) 20-byteheader, and maximum total length of 65,535 bytes.

a segment is fragmented by the network layer when it is larger thanthe network’s maximum transfer unit (MTU).

Paolo Costa 06 - Transport Layer TCP 37 / 52

Page 172: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Transmission Control Protocol (TCP)

Connection-oriented service that supports byte streams (notmessage streams)

a sender may send eight 512-byte packets that are received as twochunks of 1024 bytes, and one of 2048 bytes.

Transport address consists of a 16-bit port number, whichaugments the underlying IP address.TCP ensures reliable, point–to–point connections

No support for multicasting or broadcasting.A TCP TPDU is called a segment, consisting of (minimal) 20-byteheader, and maximum total length of 65,535 bytes.

a segment is fragmented by the network layer when it is larger thanthe network’s maximum transfer unit (MTU).

Paolo Costa 06 - Transport Layer TCP 37 / 52

Page 173: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

TCP Header0 31

Sequence and acknowledgment numbers refer to bytes not to messagesURG indicates immediate processing and transmission: the receiver is signalledAcknowledgments are piggybacked when ACK = 1

acks specify the next byte expected, not the last one received

PSH: used to solicit the receiver to pass the data to the application immediatelyRST is used to reset a connection (also by ISPs to stop P2P traffic)SYN is for connection setup (ACK = 0: request; ACK = 1: accepted)FIN is for connection release. Data sent before the release is not lostWindow size can be at most 64 Kbytes (16 bits)

a Window Scale option can be specified to have a window size of 230

Paolo Costa 06 - Transport Layer TCP 38 / 52

Page 174: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

TCP Header0 31

source port destination port

Sequence and acknowledgment numbers refer to bytes not to messagesURG indicates immediate processing and transmission: the receiver is signalledAcknowledgments are piggybacked when ACK = 1

acks specify the next byte expected, not the last one received

PSH: used to solicit the receiver to pass the data to the application immediatelyRST is used to reset a connection (also by ISPs to stop P2P traffic)SYN is for connection setup (ACK = 0: request; ACK = 1: accepted)FIN is for connection release. Data sent before the release is not lostWindow size can be at most 64 Kbytes (16 bits)

a Window Scale option can be specified to have a window size of 230

Paolo Costa 06 - Transport Layer TCP 38 / 52

Page 175: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

TCP Header0 31

source port destination port

sequence number

acknowledgment number

Sequence and acknowledgment numbers refer to bytes not to messages

URG indicates immediate processing and transmission: the receiver is signalledAcknowledgments are piggybacked when ACK = 1

acks specify the next byte expected, not the last one received

PSH: used to solicit the receiver to pass the data to the application immediatelyRST is used to reset a connection (also by ISPs to stop P2P traffic)SYN is for connection setup (ACK = 0: request; ACK = 1: accepted)FIN is for connection release. Data sent before the release is not lostWindow size can be at most 64 Kbytes (16 bits)

a Window Scale option can be specified to have a window size of 230

Paolo Costa 06 - Transport Layer TCP 38 / 52

Page 176: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

TCP Header0 31

source port destination port

sequence number

acknowledgment number

hdrlen unused

Sequence and acknowledgment numbers refer to bytes not to messages

URG indicates immediate processing and transmission: the receiver is signalledAcknowledgments are piggybacked when ACK = 1

acks specify the next byte expected, not the last one received

PSH: used to solicit the receiver to pass the data to the application immediatelyRST is used to reset a connection (also by ISPs to stop P2P traffic)SYN is for connection setup (ACK = 0: request; ACK = 1: accepted)FIN is for connection release. Data sent before the release is not lostWindow size can be at most 64 Kbytes (16 bits)

a Window Scale option can be specified to have a window size of 230

Paolo Costa 06 - Transport Layer TCP 38 / 52

Page 177: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

TCP Header0 31

source port destination port

sequence number

acknowledgment number

hdrlen unused U

Sequence and acknowledgment numbers refer to bytes not to messagesURG indicates immediate processing and transmission: the receiver is signalled

Acknowledgments are piggybacked when ACK = 1

acks specify the next byte expected, not the last one received

PSH: used to solicit the receiver to pass the data to the application immediatelyRST is used to reset a connection (also by ISPs to stop P2P traffic)SYN is for connection setup (ACK = 0: request; ACK = 1: accepted)FIN is for connection release. Data sent before the release is not lostWindow size can be at most 64 Kbytes (16 bits)

a Window Scale option can be specified to have a window size of 230

Paolo Costa 06 - Transport Layer TCP 38 / 52

Page 178: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

TCP Header0 31

source port destination port

sequence number

acknowledgment number

hdrlen unused U A

Sequence and acknowledgment numbers refer to bytes not to messagesURG indicates immediate processing and transmission: the receiver is signalledAcknowledgments are piggybacked when ACK = 1

acks specify the next byte expected, not the last one received

PSH: used to solicit the receiver to pass the data to the application immediatelyRST is used to reset a connection (also by ISPs to stop P2P traffic)SYN is for connection setup (ACK = 0: request; ACK = 1: accepted)FIN is for connection release. Data sent before the release is not lostWindow size can be at most 64 Kbytes (16 bits)

a Window Scale option can be specified to have a window size of 230

Paolo Costa 06 - Transport Layer TCP 38 / 52

Page 179: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

TCP Header0 31

source port destination port

sequence number

acknowledgment number

hdrlen unused U A P

Sequence and acknowledgment numbers refer to bytes not to messagesURG indicates immediate processing and transmission: the receiver is signalledAcknowledgments are piggybacked when ACK = 1

acks specify the next byte expected, not the last one receivedPSH: used to solicit the receiver to pass the data to the application immediately

RST is used to reset a connection (also by ISPs to stop P2P traffic)SYN is for connection setup (ACK = 0: request; ACK = 1: accepted)FIN is for connection release. Data sent before the release is not lostWindow size can be at most 64 Kbytes (16 bits)

a Window Scale option can be specified to have a window size of 230

Paolo Costa 06 - Transport Layer TCP 38 / 52

Page 180: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

TCP Header0 31

source port destination port

sequence number

acknowledgment number

hdrlen unused U A P R

Sequence and acknowledgment numbers refer to bytes not to messagesURG indicates immediate processing and transmission: the receiver is signalledAcknowledgments are piggybacked when ACK = 1

acks specify the next byte expected, not the last one receivedPSH: used to solicit the receiver to pass the data to the application immediatelyRST is used to reset a connection (also by ISPs to stop P2P traffic)

SYN is for connection setup (ACK = 0: request; ACK = 1: accepted)FIN is for connection release. Data sent before the release is not lostWindow size can be at most 64 Kbytes (16 bits)

a Window Scale option can be specified to have a window size of 230

Paolo Costa 06 - Transport Layer TCP 38 / 52

Page 181: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

TCP Header0 31

source port destination port

sequence number

acknowledgment number

hdrlen unused U A P R S

Sequence and acknowledgment numbers refer to bytes not to messagesURG indicates immediate processing and transmission: the receiver is signalledAcknowledgments are piggybacked when ACK = 1

acks specify the next byte expected, not the last one receivedPSH: used to solicit the receiver to pass the data to the application immediatelyRST is used to reset a connection (also by ISPs to stop P2P traffic)SYN is for connection setup (ACK = 0: request; ACK = 1: accepted)

FIN is for connection release. Data sent before the release is not lostWindow size can be at most 64 Kbytes (16 bits)

a Window Scale option can be specified to have a window size of 230

Paolo Costa 06 - Transport Layer TCP 38 / 52

Page 182: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

TCP Header0 31

source port destination port

sequence number

acknowledgment number

hdrlen unused U A P R S F

Sequence and acknowledgment numbers refer to bytes not to messagesURG indicates immediate processing and transmission: the receiver is signalledAcknowledgments are piggybacked when ACK = 1

acks specify the next byte expected, not the last one receivedPSH: used to solicit the receiver to pass the data to the application immediatelyRST is used to reset a connection (also by ISPs to stop P2P traffic)SYN is for connection setup (ACK = 0: request; ACK = 1: accepted)FIN is for connection release. Data sent before the release is not lost

Window size can be at most 64 Kbytes (16 bits)

a Window Scale option can be specified to have a window size of 230

Paolo Costa 06 - Transport Layer TCP 38 / 52

Page 183: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

TCP Header0 31

source port destination port

sequence number

acknowledgment number

hdrlen unused U A P R S F window size

Sequence and acknowledgment numbers refer to bytes not to messagesURG indicates immediate processing and transmission: the receiver is signalledAcknowledgments are piggybacked when ACK = 1

acks specify the next byte expected, not the last one receivedPSH: used to solicit the receiver to pass the data to the application immediatelyRST is used to reset a connection (also by ISPs to stop P2P traffic)SYN is for connection setup (ACK = 0: request; ACK = 1: accepted)FIN is for connection release. Data sent before the release is not lostWindow size can be at most 64 Kbytes (16 bits)

a Window Scale option can be specified to have a window size of 230

Paolo Costa 06 - Transport Layer TCP 38 / 52

Page 184: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

TCP Header0 31

source port destination port

sequence number

acknowledgment number

hdrlen unused U A P R S F window size

checksum urgent data pointer

Sequence and acknowledgment numbers refer to bytes not to messagesURG indicates immediate processing and transmission: the receiver is signalledAcknowledgments are piggybacked when ACK = 1

acks specify the next byte expected, not the last one receivedPSH: used to solicit the receiver to pass the data to the application immediatelyRST is used to reset a connection (also by ISPs to stop P2P traffic)SYN is for connection setup (ACK = 0: request; ACK = 1: accepted)FIN is for connection release. Data sent before the release is not lostWindow size can be at most 64 Kbytes (16 bits)

a Window Scale option can be specified to have a window size of 230

Paolo Costa 06 - Transport Layer TCP 38 / 52

Page 185: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

TCP Header0 31

source port destination port

sequence number

acknowledgment number

hdrlen unused U A P R S F window size

checksum urgent data pointer

options field

Sequence and acknowledgment numbers refer to bytes not to messagesURG indicates immediate processing and transmission: the receiver is signalledAcknowledgments are piggybacked when ACK = 1

acks specify the next byte expected, not the last one receivedPSH: used to solicit the receiver to pass the data to the application immediatelyRST is used to reset a connection (also by ISPs to stop P2P traffic)SYN is for connection setup (ACK = 0: request; ACK = 1: accepted)FIN is for connection release. Data sent before the release is not lostWindow size can be at most 64 Kbytes (16 bits)

a Window Scale option can be specified to have a window size of 230

Paolo Costa 06 - Transport Layer TCP 38 / 52

Page 186: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Sequence Numbers

Sequence numbers are associated with bytes in the data streamnot with segments, as we have used them before

The sequence number in a TCP segment indicates the sequencenumber of the first byte carried by that segment

application data stream4Kb

Paolo Costa 06 - Transport Layer TCP 39 / 52

Page 187: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Sequence Numbers

Sequence numbers are associated with bytes in the data streamnot with segments, as we have used them before

The sequence number in a TCP segment indicates the sequencenumber of the first byte carried by that segment

application data stream4Kb

Paolo Costa 06 - Transport Layer TCP 39 / 52

Page 188: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Sequence Numbers

Sequence numbers are associated with bytes in the data streamnot with segments, as we have used them before

The sequence number in a TCP segment indicates the sequencenumber of the first byte carried by that segment

application data stream4Kb

Paolo Costa 06 - Transport Layer TCP 39 / 52

Page 189: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Sequence Numbers

Sequence numbers are associated with bytes in the data streamnot with segments, as we have used them before

The sequence number in a TCP segment indicates the sequencenumber of the first byte carried by that segment

application data stream4Kb

MSS=1024b

Paolo Costa 06 - Transport Layer TCP 39 / 52

Page 190: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Sequence Numbers

Sequence numbers are associated with bytes in the data streamnot with segments, as we have used them before

The sequence number in a TCP segment indicates the sequencenumber of the first byte carried by that segment

application data stream4Kb

MSS=1024b

Paolo Costa 06 - Transport Layer TCP 39 / 52

Page 191: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Sequence Numbers

Sequence numbers are associated with bytes in the data streamnot with segments, as we have used them before

The sequence number in a TCP segment indicates the sequencenumber of the first byte carried by that segment

application data stream4Kb

MSS=1024b

1. . . . . . 1024 1025. . . 2048 2049. . . 3072 3073. . . 4096

Paolo Costa 06 - Transport Layer TCP 39 / 52

Page 192: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Sequence Numbers

Sequence numbers are associated with bytes in the data streamnot with segments, as we have used them before

The sequence number in a TCP segment indicates the sequencenumber of the first byte carried by that segment

application data stream4Kb

MSS=1024b

1. . . . . . 1024 1025. . . 2048 2049. . . 3072 3073. . . 4096

a TCP segment

Paolo Costa 06 - Transport Layer TCP 39 / 52

Page 193: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Sequence Numbers

Sequence numbers are associated with bytes in the data streamnot with segments, as we have used them before

The sequence number in a TCP segment indicates the sequencenumber of the first byte carried by that segment

application data stream4Kb

MSS=1024b

1. . . . . . 1024 1025. . . 2048 2049. . . 3072 3073. . . 4096

a TCP segment

2049

Paolo Costa 06 - Transport Layer TCP 39 / 52

Page 194: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Sequence Numbers

Sequence numbers are associated with bytes in the data streamnot with segments, as we have used them before

The sequence number in a TCP segment indicates the sequencenumber of the first byte carried by that segment

application data stream4Kb

MSS=1024b

1. . . . . . 1024 1025. . . 2048 2049. . . 3072 3073. . . 4096

a TCP segment

2049

sequence number

Paolo Costa 06 - Transport Layer TCP 39 / 52

Page 195: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Acknowledgment Numbers

An acknowledgment number represents the first sequencenumber not yet seen by the receiver

TCP acknowledgments are “cumulative”

A B

Paolo Costa 06 - Transport Layer TCP 40 / 52

Page 196: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Acknowledgment Numbers

An acknowledgment number represents the first sequencenumber not yet seen by the receiver

TCP acknowledgments are “cumulative”

A B

Paolo Costa 06 - Transport Layer TCP 40 / 52

Page 197: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Acknowledgment Numbers

An acknowledgment number represents the first sequencenumber not yet seen by the receiver

TCP acknowledgments are “cumulative”

A B

[Seq# = 1200, . . .], size(data) = 1000

Paolo Costa 06 - Transport Layer TCP 40 / 52

Page 198: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Acknowledgment Numbers

An acknowledgment number represents the first sequencenumber not yet seen by the receiver

TCP acknowledgments are “cumulative”

A B

[Seq# = 1200, . . .], size(data) = 1000

[Seq# = 2200, . . .], size(data) = 500

Paolo Costa 06 - Transport Layer TCP 40 / 52

Page 199: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Acknowledgment Numbers

An acknowledgment number represents the first sequencenumber not yet seen by the receiver

TCP acknowledgments are “cumulative”

A B

[Seq# = 1200, . . .], size(data) = 1000

[Seq# = 2200, . . .], size(data) = 500

[Seq# = . . . , Ack# = 2700]

Paolo Costa 06 - Transport Layer TCP 40 / 52

Page 200: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

TCP Connection Management

Connection establishment:three-way handshake protocolinitial sequence numbers are chosen through a clock basedscheme (clock tick is 4 µs)

Connection release:to be thought of as independent releases of two simplexconnectionsto release a connection, either party can send a TCP segment withthe FIN bit setwhen the FIN is acknowledged, that direction is shut downwhen both directions are shut down, the connection is releasedto avoid the two-army problem, timers are used

Paolo Costa 06 - Transport Layer TCP 41 / 52

Page 201: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

TCP Connection Management

Connection establishment:three-way handshake protocolinitial sequence numbers are chosen through a clock basedscheme (clock tick is 4 µs)

Connection release:to be thought of as independent releases of two simplexconnectionsto release a connection, either party can send a TCP segment withthe FIN bit setwhen the FIN is acknowledged, that direction is shut downwhen both directions are shut down, the connection is released

to avoid the two-army problem, timers are used

Paolo Costa 06 - Transport Layer TCP 41 / 52

Page 202: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

TCP Connection Management

Connection establishment:three-way handshake protocolinitial sequence numbers are chosen through a clock basedscheme (clock tick is 4 µs)

Connection release:to be thought of as independent releases of two simplexconnectionsto release a connection, either party can send a TCP segment withthe FIN bit setwhen the FIN is acknowledged, that direction is shut downwhen both directions are shut down, the connection is releasedto avoid the two-army problem, timers are used

Paolo Costa 06 - Transport Layer TCP 41 / 52

Page 203: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

TCP Connection Management ModelingStates

State DescriptionCLOSED No connection active or pendingLISTEN Server waiting for conn. requestSYN RCVD Conn. request has arrived; wait for ACKSYN SENT Conn. request just sent; wait for SYN+ACKESTABLISHED Data can be sent and receivedFIN WAIT 1 Client just sent conn. releaseFIN WAIT 2 Server just agreed to release connectionTIMED WAIT Wait for all packets to dieCLOSING Client & server both tried to closeCLOSE WAIT Other side initiated releaseLAST ACK Wait for all packets to die

Paolo Costa 06 - Transport Layer TCP 42 / 52

Page 204: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

TCP Connection Management ModelingFinite States Machine

Paolo Costa 06 - Transport Layer TCP 43 / 52

Page 205: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

TCP Window Management

The receiver sends an acknowledgment for the next byte that canbe sent in the current stream, and the maximum number of bytesthat may be sent.

a window size of 0 is legalit means that no more messages can be sent......apart from a 1-byte segment to ping the receivers (no deadlocks)

Paolo Costa 06 - Transport Layer TCP 44 / 52

Page 206: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

TCP Window Management

The receiver sends an acknowledgment for the next byte that canbe sent in the current stream, and the maximum number of bytesthat may be sent.

a window size of 0 is legalit means that no more messages can be sent......apart from a 1-byte segment to ping the receivers (no deadlocks)

Paolo Costa 06 - Transport Layer TCP 44 / 52

Page 207: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

TCP Window ManagementOptimizations

The TCP entity is not obliged to immediately transmit data that theapplication hands over

it can do as much buffering as it likessame goes for acknowledgments: wait in the hope to have somedata and piggyback them

Nagle’s algorithm

Problem: consider interactive, character-oriented applications:sending 1 character per message would cost 40 byte of overhead(TCP + IP header) per byte of dataSolution: Send the first character immediately and then buffer asmuch characters as possible until the previous batch isacknowledgednot suitable for remote desktop (mouse movements need besmooth)

Silly window syndrome

Problem: the receiver reads one byte at a time and acknowledgesone at a timeSolution: the receiver should wait until it has freed enough bufferand can receive a reasonable amount of bytes in a row

Paolo Costa 06 - Transport Layer TCP 45 / 52

Page 208: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

TCP Window ManagementOptimizations

The TCP entity is not obliged to immediately transmit data that theapplication hands over

it can do as much buffering as it likessame goes for acknowledgments: wait in the hope to have somedata and piggyback them

Nagle’s algorithmProblem: consider interactive, character-oriented applications:sending 1 character per message would cost 40 byte of overhead(TCP + IP header) per byte of data

Solution: Send the first character immediately and then buffer asmuch characters as possible until the previous batch isacknowledgednot suitable for remote desktop (mouse movements need besmooth)

Silly window syndrome

Problem: the receiver reads one byte at a time and acknowledgesone at a timeSolution: the receiver should wait until it has freed enough bufferand can receive a reasonable amount of bytes in a row

Paolo Costa 06 - Transport Layer TCP 45 / 52

Page 209: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

TCP Window ManagementOptimizations

The TCP entity is not obliged to immediately transmit data that theapplication hands over

it can do as much buffering as it likessame goes for acknowledgments: wait in the hope to have somedata and piggyback them

Nagle’s algorithmProblem: consider interactive, character-oriented applications:sending 1 character per message would cost 40 byte of overhead(TCP + IP header) per byte of dataSolution: Send the first character immediately and then buffer asmuch characters as possible until the previous batch isacknowledged

not suitable for remote desktop (mouse movements need besmooth)

Silly window syndrome

Problem: the receiver reads one byte at a time and acknowledgesone at a timeSolution: the receiver should wait until it has freed enough bufferand can receive a reasonable amount of bytes in a row

Paolo Costa 06 - Transport Layer TCP 45 / 52

Page 210: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

TCP Window ManagementOptimizations

The TCP entity is not obliged to immediately transmit data that theapplication hands over

it can do as much buffering as it likessame goes for acknowledgments: wait in the hope to have somedata and piggyback them

Nagle’s algorithmProblem: consider interactive, character-oriented applications:sending 1 character per message would cost 40 byte of overhead(TCP + IP header) per byte of dataSolution: Send the first character immediately and then buffer asmuch characters as possible until the previous batch isacknowledgednot suitable for remote desktop (mouse movements need besmooth)

Silly window syndrome

Problem: the receiver reads one byte at a time and acknowledgesone at a timeSolution: the receiver should wait until it has freed enough bufferand can receive a reasonable amount of bytes in a row

Paolo Costa 06 - Transport Layer TCP 45 / 52

Page 211: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

TCP Window ManagementOptimizations

The TCP entity is not obliged to immediately transmit data that theapplication hands over

it can do as much buffering as it likessame goes for acknowledgments: wait in the hope to have somedata and piggyback them

Nagle’s algorithmProblem: consider interactive, character-oriented applications:sending 1 character per message would cost 40 byte of overhead(TCP + IP header) per byte of dataSolution: Send the first character immediately and then buffer asmuch characters as possible until the previous batch isacknowledgednot suitable for remote desktop (mouse movements need besmooth)

Silly window syndrome

Problem: the receiver reads one byte at a time and acknowledgesone at a timeSolution: the receiver should wait until it has freed enough bufferand can receive a reasonable amount of bytes in a row

Paolo Costa 06 - Transport Layer TCP 45 / 52

Page 212: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

TCP Window ManagementOptimizations

The TCP entity is not obliged to immediately transmit data that theapplication hands over

it can do as much buffering as it likessame goes for acknowledgments: wait in the hope to have somedata and piggyback them

Nagle’s algorithmProblem: consider interactive, character-oriented applications:sending 1 character per message would cost 40 byte of overhead(TCP + IP header) per byte of dataSolution: Send the first character immediately and then buffer asmuch characters as possible until the previous batch isacknowledgednot suitable for remote desktop (mouse movements need besmooth)

Silly window syndromeProblem: the receiver reads one byte at a time and acknowledgesone at a time

Solution: the receiver should wait until it has freed enough bufferand can receive a reasonable amount of bytes in a row

Paolo Costa 06 - Transport Layer TCP 45 / 52

Page 213: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

TCP Window ManagementOptimizations

The TCP entity is not obliged to immediately transmit data that theapplication hands over

it can do as much buffering as it likessame goes for acknowledgments: wait in the hope to have somedata and piggyback them

Nagle’s algorithmProblem: consider interactive, character-oriented applications:sending 1 character per message would cost 40 byte of overhead(TCP + IP header) per byte of dataSolution: Send the first character immediately and then buffer asmuch characters as possible until the previous batch isacknowledgednot suitable for remote desktop (mouse movements need besmooth)

Silly window syndromeProblem: the receiver reads one byte at a time and acknowledgesone at a timeSolution: the receiver should wait until it has freed enough bufferand can receive a reasonable amount of bytes in a row

Paolo Costa 06 - Transport Layer TCP 45 / 52

Page 214: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

TCP Congestion Control

Problem: As before, the transport layer has to take into accountthat the underlying network can be the bottleneck.How do we detect and react to congestion ?

Solution: use a congestion window next to the window granted bythe receiver

The actual window size is the minimum of the two.

Jacobson’s Slow start

1. Initialize congestion window to the maximum segment size2. Send it off.3. If it gets acknowledged, double the size (slow start)4. Repeat until failure.5. In addition, use a threshold.

On a timeout, lower the threshold to 50 % of the congestion windowdo a slow start (exponential) until new thresholdadd maximum segment size to congestion window size after that(linear growth).

Paolo Costa 06 - Transport Layer TCP 46 / 52

Page 215: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

TCP Congestion Control

Problem: As before, the transport layer has to take into accountthat the underlying network can be the bottleneck.How do we detect and react to congestion ?Solution: use a congestion window next to the window granted bythe receiver

The actual window size is the minimum of the two.

Jacobson’s Slow start

1. Initialize congestion window to the maximum segment size2. Send it off.3. If it gets acknowledged, double the size (slow start)4. Repeat until failure.5. In addition, use a threshold.

On a timeout, lower the threshold to 50 % of the congestion windowdo a slow start (exponential) until new thresholdadd maximum segment size to congestion window size after that(linear growth).

Paolo Costa 06 - Transport Layer TCP 46 / 52

Page 216: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

TCP Congestion Control

Problem: As before, the transport layer has to take into accountthat the underlying network can be the bottleneck.How do we detect and react to congestion ?Solution: use a congestion window next to the window granted bythe receiver

The actual window size is the minimum of the two.

Jacobson’s Slow start1. Initialize congestion window to the maximum segment size

2. Send it off.3. If it gets acknowledged, double the size (slow start)4. Repeat until failure.5. In addition, use a threshold.

On a timeout, lower the threshold to 50 % of the congestion windowdo a slow start (exponential) until new thresholdadd maximum segment size to congestion window size after that(linear growth).

Paolo Costa 06 - Transport Layer TCP 46 / 52

Page 217: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

TCP Congestion Control

Problem: As before, the transport layer has to take into accountthat the underlying network can be the bottleneck.How do we detect and react to congestion ?Solution: use a congestion window next to the window granted bythe receiver

The actual window size is the minimum of the two.

Jacobson’s Slow start1. Initialize congestion window to the maximum segment size2. Send it off.

3. If it gets acknowledged, double the size (slow start)4. Repeat until failure.5. In addition, use a threshold.

On a timeout, lower the threshold to 50 % of the congestion windowdo a slow start (exponential) until new thresholdadd maximum segment size to congestion window size after that(linear growth).

Paolo Costa 06 - Transport Layer TCP 46 / 52

Page 218: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

TCP Congestion Control

Problem: As before, the transport layer has to take into accountthat the underlying network can be the bottleneck.How do we detect and react to congestion ?Solution: use a congestion window next to the window granted bythe receiver

The actual window size is the minimum of the two.

Jacobson’s Slow start1. Initialize congestion window to the maximum segment size2. Send it off.3. If it gets acknowledged, double the size (slow start)

4. Repeat until failure.5. In addition, use a threshold.

On a timeout, lower the threshold to 50 % of the congestion windowdo a slow start (exponential) until new thresholdadd maximum segment size to congestion window size after that(linear growth).

Paolo Costa 06 - Transport Layer TCP 46 / 52

Page 219: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

TCP Congestion Control

Problem: As before, the transport layer has to take into accountthat the underlying network can be the bottleneck.How do we detect and react to congestion ?Solution: use a congestion window next to the window granted bythe receiver

The actual window size is the minimum of the two.

Jacobson’s Slow start1. Initialize congestion window to the maximum segment size2. Send it off.3. If it gets acknowledged, double the size (slow start)4. Repeat until failure.

5. In addition, use a threshold.

On a timeout, lower the threshold to 50 % of the congestion windowdo a slow start (exponential) until new thresholdadd maximum segment size to congestion window size after that(linear growth).

Paolo Costa 06 - Transport Layer TCP 46 / 52

Page 220: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

TCP Congestion Control

Problem: As before, the transport layer has to take into accountthat the underlying network can be the bottleneck.How do we detect and react to congestion ?Solution: use a congestion window next to the window granted bythe receiver

The actual window size is the minimum of the two.

Jacobson’s Slow start1. Initialize congestion window to the maximum segment size2. Send it off.3. If it gets acknowledged, double the size (slow start)4. Repeat until failure.5. In addition, use a threshold.

On a timeout, lower the threshold to 50 % of the congestion windowdo a slow start (exponential) until new thresholdadd maximum segment size to congestion window size after that(linear growth).

Paolo Costa 06 - Transport Layer TCP 46 / 52

Page 221: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

TCP Congestion Control

Problem: As before, the transport layer has to take into accountthat the underlying network can be the bottleneck.How do we detect and react to congestion ?Solution: use a congestion window next to the window granted bythe receiver

The actual window size is the minimum of the two.

Jacobson’s Slow start1. Initialize congestion window to the maximum segment size2. Send it off.3. If it gets acknowledged, double the size (slow start)4. Repeat until failure.5. In addition, use a threshold.

On a timeout, lower the threshold to 50 % of the congestion window

do a slow start (exponential) until new thresholdadd maximum segment size to congestion window size after that(linear growth).

Paolo Costa 06 - Transport Layer TCP 46 / 52

Page 222: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

TCP Congestion Control

Problem: As before, the transport layer has to take into accountthat the underlying network can be the bottleneck.How do we detect and react to congestion ?Solution: use a congestion window next to the window granted bythe receiver

The actual window size is the minimum of the two.

Jacobson’s Slow start1. Initialize congestion window to the maximum segment size2. Send it off.3. If it gets acknowledged, double the size (slow start)4. Repeat until failure.5. In addition, use a threshold.

On a timeout, lower the threshold to 50 % of the congestion windowdo a slow start (exponential) until new threshold

add maximum segment size to congestion window size after that(linear growth).

Paolo Costa 06 - Transport Layer TCP 46 / 52

Page 223: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

TCP Congestion Control

Problem: As before, the transport layer has to take into accountthat the underlying network can be the bottleneck.How do we detect and react to congestion ?Solution: use a congestion window next to the window granted bythe receiver

The actual window size is the minimum of the two.

Jacobson’s Slow start1. Initialize congestion window to the maximum segment size2. Send it off.3. If it gets acknowledged, double the size (slow start)4. Repeat until failure.5. In addition, use a threshold.

On a timeout, lower the threshold to 50 % of the congestion windowdo a slow start (exponential) until new thresholdadd maximum segment size to congestion window size after that(linear growth).

Paolo Costa 06 - Transport Layer TCP 46 / 52

Page 224: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

TCP Congestion ControlExample

Initially, the congestion window was 64 KB, but a timeout occurred

⇒ the threshold is set to 32 KB and the congestion window to 1 KBThe window then grows exponentially until it hits the threshold (32 KB).

starting then, it grows linearly.

Transmission 13 is unlucky and a timeout occurs.

the threshold is set to half the current window, and slow start is re-initiated

Paolo Costa 06 - Transport Layer TCP 47 / 52

Page 225: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

TCP Congestion ControlExample

Initially, the congestion window was 64 KB, but a timeout occurred⇒ the threshold is set to 32 KB and the congestion window to 1 KB

The window then grows exponentially until it hits the threshold (32 KB).

starting then, it grows linearly.

Transmission 13 is unlucky and a timeout occurs.

the threshold is set to half the current window, and slow start is re-initiated

Paolo Costa 06 - Transport Layer TCP 47 / 52

Page 226: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

TCP Congestion ControlExample

Initially, the congestion window was 64 KB, but a timeout occurred⇒ the threshold is set to 32 KB and the congestion window to 1 KB

The window then grows exponentially until it hits the threshold (32 KB).

starting then, it grows linearly.Transmission 13 is unlucky and a timeout occurs.

the threshold is set to half the current window, and slow start is re-initiated

Paolo Costa 06 - Transport Layer TCP 47 / 52

Page 227: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

TCP Congestion ControlExample

Initially, the congestion window was 64 KB, but a timeout occurred⇒ the threshold is set to 32 KB and the congestion window to 1 KB

The window then grows exponentially until it hits the threshold (32 KB).starting then, it grows linearly.

Transmission 13 is unlucky and a timeout occurs.

the threshold is set to half the current window, and slow start is re-initiated

Paolo Costa 06 - Transport Layer TCP 47 / 52

Page 228: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

TCP Congestion ControlExample

Initially, the congestion window was 64 KB, but a timeout occurred⇒ the threshold is set to 32 KB and the congestion window to 1 KB

The window then grows exponentially until it hits the threshold (32 KB).starting then, it grows linearly.

Transmission 13 is unlucky and a timeout occurs.

the threshold is set to half the current window, and slow start is re-initiated

Paolo Costa 06 - Transport Layer TCP 47 / 52

Page 229: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

TCP Congestion ControlExample

Initially, the congestion window was 64 KB, but a timeout occurred⇒ the threshold is set to 32 KB and the congestion window to 1 KB

The window then grows exponentially until it hits the threshold (32 KB).starting then, it grows linearly.

Transmission 13 is unlucky and a timeout occurs.the threshold is set to half the current window, and slow start is re-initiated

Paolo Costa 06 - Transport Layer TCP 47 / 52

Page 230: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

TCP Timer Management (1/2)Problem: How do we determine the best retransmission timeout ?

Situation is really different from what happens at data link layer (a)At transport layer (b) we observe a large standard deviation

Solution: use a highly dynamic algorithm that constantly adjuststhe timeout interval, based on continuous measurements(Jacobson again...)

For each connection, TCP maintains a variable, RTT , that is thebest current estimate of the round-trip timeIf the acknowledgment gets back before the timer expires, TCPmeasures how long the acknowledgment took, say, M.It then updates RTT according to the formula:

RTT = αRTT + (1− α)M Typically α = 7/8

Paolo Costa 06 - Transport Layer TCP 48 / 52

Page 231: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

TCP Timer Management (1/2)Problem: How do we determine the best retransmission timeout ?

Situation is really different from what happens at data link layer (a)At transport layer (b) we observe a large standard deviation

Solution: use a highly dynamic algorithm that constantly adjuststhe timeout interval, based on continuous measurements(Jacobson again...)

For each connection, TCP maintains a variable, RTT , that is thebest current estimate of the round-trip timeIf the acknowledgment gets back before the timer expires, TCPmeasures how long the acknowledgment took, say, M.It then updates RTT according to the formula:

RTT = αRTT + (1− α)M Typically α = 7/8

Paolo Costa 06 - Transport Layer TCP 48 / 52

Page 232: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

TCP Timer Management (1/2)Problem: How do we determine the best retransmission timeout ?

Situation is really different from what happens at data link layer (a)At transport layer (b) we observe a large standard deviation

Solution: use a highly dynamic algorithm that constantly adjuststhe timeout interval, based on continuous measurements(Jacobson again...)

For each connection, TCP maintains a variable, RTT , that is thebest current estimate of the round-trip time

If the acknowledgment gets back before the timer expires, TCPmeasures how long the acknowledgment took, say, M.It then updates RTT according to the formula:

RTT = αRTT + (1− α)M

Typically α = 7/8

Paolo Costa 06 - Transport Layer TCP 48 / 52

Page 233: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

TCP Timer Management (1/2)Problem: How do we determine the best retransmission timeout ?

Situation is really different from what happens at data link layer (a)At transport layer (b) we observe a large standard deviation

Solution: use a highly dynamic algorithm that constantly adjuststhe timeout interval, based on continuous measurements(Jacobson again...)

For each connection, TCP maintains a variable, RTT , that is thebest current estimate of the round-trip timeIf the acknowledgment gets back before the timer expires, TCPmeasures how long the acknowledgment took, say, M.

It then updates RTT according to the formula:

RTT = αRTT + (1− α)M

Typically α = 7/8

Paolo Costa 06 - Transport Layer TCP 48 / 52

Page 234: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

TCP Timer Management (1/2)Problem: How do we determine the best retransmission timeout ?

Situation is really different from what happens at data link layer (a)At transport layer (b) we observe a large standard deviation

Solution: use a highly dynamic algorithm that constantly adjuststhe timeout interval, based on continuous measurements(Jacobson again...)

For each connection, TCP maintains a variable, RTT , that is thebest current estimate of the round-trip timeIf the acknowledgment gets back before the timer expires, TCPmeasures how long the acknowledgment took, say, M.It then updates RTT according to the formula:

RTT = αRTT + (1− α)M

Typically α = 7/8

Paolo Costa 06 - Transport Layer TCP 48 / 52

Page 235: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

TCP Timer Management (1/2)Problem: How do we determine the best retransmission timeout ?

Situation is really different from what happens at data link layer (a)At transport layer (b) we observe a large standard deviation

Solution: use a highly dynamic algorithm that constantly adjuststhe timeout interval, based on continuous measurements(Jacobson again...)

For each connection, TCP maintains a variable, RTT , that is thebest current estimate of the round-trip timeIf the acknowledgment gets back before the timer expires, TCPmeasures how long the acknowledgment took, say, M.It then updates RTT according to the formula:

RTT = αRTT + (1− α)M

Typically α = 7/8

Paolo Costa 06 - Transport Layer TCP 48 / 52

Page 236: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

TCP Timer Management (1/2)Problem: How do we determine the best retransmission timeout ?

Situation is really different from what happens at data link layer (a)At transport layer (b) we observe a large standard deviation

Solution: use a highly dynamic algorithm that constantly adjuststhe timeout interval, based on continuous measurements(Jacobson again...)

For each connection, TCP maintains a variable, RTT , that is thebest current estimate of the round-trip timeIf the acknowledgment gets back before the timer expires, TCPmeasures how long the acknowledgment took, say, M.It then updates RTT according to the formula:

RTT = αRTT + (1− α)M Typically α = 7/8Paolo Costa 06 - Transport Layer TCP 48 / 52

Page 237: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

TCP Timer Management (2/2)

Even given a good value of RTT, choosing a suitableretransmission timeout, i.e., β · RTT , is nontrivial

Jacobson proposed making β roughly proportional to the standarddeviation of the acknowledgment arrival time probability density

he suggested using the mean deviation D as a cheap estimator ofthe standard deviationwhenever an ack comes in, a new value of D is created:

D = αD + (1− α)|RTT −M|if a packet got wrong (ack didn’t arrive), don’t update TTL(Karn’s algorithm)

Most TCP implementations now use this algorithm and set thetimeout interval to:

Timeout = RTT + 4 · DOther timers are maintained by TCP

persistence timer: prevents deadlock when window size is 0keepalive timer: check the connection if it has been idle for longconnection release timer: used when closing a connection

Paolo Costa 06 - Transport Layer TCP 49 / 52

Page 238: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

TCP Timer Management (2/2)

Even given a good value of RTT, choosing a suitableretransmission timeout, i.e., β · RTT , is nontrivialJacobson proposed making β roughly proportional to the standarddeviation of the acknowledgment arrival time probability density

he suggested using the mean deviation D as a cheap estimator ofthe standard deviationwhenever an ack comes in, a new value of D is created:

D = αD + (1− α)|RTT −M|if a packet got wrong (ack didn’t arrive), don’t update TTL(Karn’s algorithm)

Most TCP implementations now use this algorithm and set thetimeout interval to:

Timeout = RTT + 4 · DOther timers are maintained by TCP

persistence timer: prevents deadlock when window size is 0keepalive timer: check the connection if it has been idle for longconnection release timer: used when closing a connection

Paolo Costa 06 - Transport Layer TCP 49 / 52

Page 239: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

TCP Timer Management (2/2)

Even given a good value of RTT, choosing a suitableretransmission timeout, i.e., β · RTT , is nontrivialJacobson proposed making β roughly proportional to the standarddeviation of the acknowledgment arrival time probability density

he suggested using the mean deviation D as a cheap estimator ofthe standard deviationwhenever an ack comes in, a new value of D is created:

D = αD + (1− α)|RTT −M|

if a packet got wrong (ack didn’t arrive), don’t update TTL(Karn’s algorithm)

Most TCP implementations now use this algorithm and set thetimeout interval to:

Timeout = RTT + 4 · DOther timers are maintained by TCP

persistence timer: prevents deadlock when window size is 0keepalive timer: check the connection if it has been idle for longconnection release timer: used when closing a connection

Paolo Costa 06 - Transport Layer TCP 49 / 52

Page 240: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

TCP Timer Management (2/2)

Even given a good value of RTT, choosing a suitableretransmission timeout, i.e., β · RTT , is nontrivialJacobson proposed making β roughly proportional to the standarddeviation of the acknowledgment arrival time probability density

he suggested using the mean deviation D as a cheap estimator ofthe standard deviationwhenever an ack comes in, a new value of D is created:

D = αD + (1− α)|RTT −M|if a packet got wrong (ack didn’t arrive), don’t update TTL(Karn’s algorithm)

Most TCP implementations now use this algorithm and set thetimeout interval to:

Timeout = RTT + 4 · DOther timers are maintained by TCP

persistence timer: prevents deadlock when window size is 0keepalive timer: check the connection if it has been idle for longconnection release timer: used when closing a connection

Paolo Costa 06 - Transport Layer TCP 49 / 52

Page 241: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

TCP Timer Management (2/2)

Even given a good value of RTT, choosing a suitableretransmission timeout, i.e., β · RTT , is nontrivialJacobson proposed making β roughly proportional to the standarddeviation of the acknowledgment arrival time probability density

he suggested using the mean deviation D as a cheap estimator ofthe standard deviationwhenever an ack comes in, a new value of D is created:

D = αD + (1− α)|RTT −M|if a packet got wrong (ack didn’t arrive), don’t update TTL(Karn’s algorithm)

Most TCP implementations now use this algorithm and set thetimeout interval to:

Timeout = RTT + 4 · D

Other timers are maintained by TCPpersistence timer: prevents deadlock when window size is 0keepalive timer: check the connection if it has been idle for longconnection release timer: used when closing a connection

Paolo Costa 06 - Transport Layer TCP 49 / 52

Page 242: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

TCP Timer Management (2/2)

Even given a good value of RTT, choosing a suitableretransmission timeout, i.e., β · RTT , is nontrivialJacobson proposed making β roughly proportional to the standarddeviation of the acknowledgment arrival time probability density

he suggested using the mean deviation D as a cheap estimator ofthe standard deviationwhenever an ack comes in, a new value of D is created:

D = αD + (1− α)|RTT −M|if a packet got wrong (ack didn’t arrive), don’t update TTL(Karn’s algorithm)

Most TCP implementations now use this algorithm and set thetimeout interval to:

Timeout = RTT + 4 · DOther timers are maintained by TCP

persistence timer: prevents deadlock when window size is 0keepalive timer: check the connection if it has been idle for longconnection release timer: used when closing a connection

Paolo Costa 06 - Transport Layer TCP 49 / 52

Page 243: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Bandwidth vs. Latency

Both bandwidth and latency influence the maximum throughput

Consider, for example, sending a 64-KB burst of data from SanDiego to Boston in order to fill the window size

only 500 µs later all the TPDUs are out on the fibersuppose that the link is 1 Gbps and the one-wayspeed-of-light-in-fiber delay is 20 msafter 20 ms, the lead TPDU hits Boston and is acknowledged.Finally, 40 ms after starting, the first acknowledgment gets back tothe sender and the second burst can be transmitted

The transmission line was used for 0.5 ms out of 40⇒ the efficiency is about 1.25 percent

The product bandwidth × latency represents the capacity of thenetwork

in the example, 1Gbps × 40 ms→ 40 millions of bitswe just sent 524,288 bits (i.e., 64 Kbytes)!

most often, the latency is the real bottleneck!

Throughput ≤0.75 ·W

RTT(if no losses), throughput ≤

1.22 ·MSS

RTTp

Ploss(with prob. Ploss)

Paolo Costa 06 - Transport Layer TCP 50 / 52

Page 244: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Bandwidth vs. Latency

Both bandwidth and latency influence the maximum throughputConsider, for example, sending a 64-KB burst of data from SanDiego to Boston in order to fill the window size

only 500 µs later all the TPDUs are out on the fibersuppose that the link is 1 Gbps and the one-wayspeed-of-light-in-fiber delay is 20 msafter 20 ms, the lead TPDU hits Boston and is acknowledged.Finally, 40 ms after starting, the first acknowledgment gets back tothe sender and the second burst can be transmitted

The transmission line was used for 0.5 ms out of 40⇒ the efficiency is about 1.25 percent

The product bandwidth × latency represents the capacity of thenetwork

in the example, 1Gbps × 40 ms→ 40 millions of bitswe just sent 524,288 bits (i.e., 64 Kbytes)!

most often, the latency is the real bottleneck!

Throughput ≤0.75 ·W

RTT(if no losses), throughput ≤

1.22 ·MSS

RTTp

Ploss(with prob. Ploss)

Paolo Costa 06 - Transport Layer TCP 50 / 52

Page 245: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Bandwidth vs. Latency

Both bandwidth and latency influence the maximum throughputConsider, for example, sending a 64-KB burst of data from SanDiego to Boston in order to fill the window size

only 500 µs later all the TPDUs are out on the fibersuppose that the link is 1 Gbps and the one-wayspeed-of-light-in-fiber delay is 20 msafter 20 ms, the lead TPDU hits Boston and is acknowledged.Finally, 40 ms after starting, the first acknowledgment gets back tothe sender and the second burst can be transmitted

The transmission line was used for 0.5 ms out of 40⇒ the efficiency is about 1.25 percent

The product bandwidth × latency represents the capacity of thenetwork

in the example, 1Gbps × 40 ms→ 40 millions of bitswe just sent 524,288 bits (i.e., 64 Kbytes)!

most often, the latency is the real bottleneck!

Throughput ≤0.75 ·W

RTT(if no losses), throughput ≤

1.22 ·MSS

RTTp

Ploss(with prob. Ploss)

Paolo Costa 06 - Transport Layer TCP 50 / 52

Page 246: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Bandwidth vs. Latency

Both bandwidth and latency influence the maximum throughputConsider, for example, sending a 64-KB burst of data from SanDiego to Boston in order to fill the window size

only 500 µs later all the TPDUs are out on the fibersuppose that the link is 1 Gbps and the one-wayspeed-of-light-in-fiber delay is 20 msafter 20 ms, the lead TPDU hits Boston and is acknowledged.Finally, 40 ms after starting, the first acknowledgment gets back tothe sender and the second burst can be transmitted

The transmission line was used for 0.5 ms out of 40⇒ the efficiency is about 1.25 percent

The product bandwidth × latency represents the capacity of thenetwork

in the example, 1Gbps × 40 ms→ 40 millions of bitswe just sent 524,288 bits (i.e., 64 Kbytes)!

most often, the latency is the real bottleneck!

Throughput ≤0.75 ·W

RTT(if no losses), throughput ≤

1.22 ·MSS

RTTp

Ploss(with prob. Ploss)

Paolo Costa 06 - Transport Layer TCP 50 / 52

Page 247: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Bandwidth vs. Latency

Both bandwidth and latency influence the maximum throughputConsider, for example, sending a 64-KB burst of data from SanDiego to Boston in order to fill the window size

only 500 µs later all the TPDUs are out on the fibersuppose that the link is 1 Gbps and the one-wayspeed-of-light-in-fiber delay is 20 msafter 20 ms, the lead TPDU hits Boston and is acknowledged.Finally, 40 ms after starting, the first acknowledgment gets back tothe sender and the second burst can be transmitted

The transmission line was used for 0.5 ms out of 40⇒ the efficiency is about 1.25 percent

The product bandwidth × latency represents the capacity of thenetwork

in the example, 1Gbps × 40 ms→ 40 millions of bitswe just sent 524,288 bits (i.e., 64 Kbytes)!

most often, the latency is the real bottleneck!

Throughput ≤0.75 ·W

RTT(if no losses),

throughput ≤1.22 ·MSS

RTTp

Ploss(with prob. Ploss)

Paolo Costa 06 - Transport Layer TCP 50 / 52

Page 248: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Bandwidth vs. Latency

Both bandwidth and latency influence the maximum throughputConsider, for example, sending a 64-KB burst of data from SanDiego to Boston in order to fill the window size

only 500 µs later all the TPDUs are out on the fibersuppose that the link is 1 Gbps and the one-wayspeed-of-light-in-fiber delay is 20 msafter 20 ms, the lead TPDU hits Boston and is acknowledged.Finally, 40 ms after starting, the first acknowledgment gets back tothe sender and the second burst can be transmitted

The transmission line was used for 0.5 ms out of 40⇒ the efficiency is about 1.25 percent

The product bandwidth × latency represents the capacity of thenetwork

in the example, 1Gbps × 40 ms→ 40 millions of bitswe just sent 524,288 bits (i.e., 64 Kbytes)!

most often, the latency is the real bottleneck!

Throughput ≤0.75 ·W

RTT(if no losses), throughput ≤

1.22 ·MSS

RTTp

Ploss(with prob. Ploss)

Paolo Costa 06 - Transport Layer TCP 50 / 52

Page 249: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Wireless TCP

Problem: TCP assumes that IP is running across wires.when packets are lost, TCP assumes this is caused by congestionand slows downin wireless environments, packets get lost due reliability issuesin those cases, TCP should do the opposite: try harder!!

Solution #1: Split TCP connections to distinguished wired/wirelessIP:

Solution #2: Let the base station do at least someretransmissions, but without informing the source.

effectively, the base station makes an attempt to improve thereliability of IP as perceived by TCP

Paolo Costa 06 - Transport Layer TCP 51 / 52

Page 250: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Wireless TCP

Problem: TCP assumes that IP is running across wires.when packets are lost, TCP assumes this is caused by congestionand slows downin wireless environments, packets get lost due reliability issuesin those cases, TCP should do the opposite: try harder!!

Solution #1: Split TCP connections to distinguished wired/wirelessIP:

Solution #2: Let the base station do at least someretransmissions, but without informing the source.

effectively, the base station makes an attempt to improve thereliability of IP as perceived by TCP

Paolo Costa 06 - Transport Layer TCP 51 / 52

Page 251: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Wireless TCP

Problem: TCP assumes that IP is running across wires.when packets are lost, TCP assumes this is caused by congestionand slows downin wireless environments, packets get lost due reliability issuesin those cases, TCP should do the opposite: try harder!!

Solution #1: Split TCP connections to distinguished wired/wirelessIP:

Solution #2: Let the base station do at least someretransmissions, but without informing the source.

effectively, the base station makes an attempt to improve thereliability of IP as perceived by TCP

Paolo Costa 06 - Transport Layer TCP 51 / 52

Page 252: Computer Networks - Transport Layerpcosta.azurewebsites.net/cn_slides/cn_06.pdf · Computer Networks Transport Layer Paolo Costa ... specifyingquality of services Depending on the

Credits

Many thanks to Maarten van Steen and Antonio Carzaniga forproviding most material for these slides

Paolo Costa 06 - Transport Layer Credits 52 / 52