Transport protocol basics

warmersafternoonΔίκτυα και Επικοινωνίες

23 Οκτ 2013 (πριν από 4 χρόνια και 18 μέρες)

68 εμφανίσεις

1

Computer Networks: A Systems Approach, 5e

Larry L. Peterson and Bruce S. Davie

End
-
to
-
End Protocols (Chapter 5)

Transport protocol basics


Reliably carrying the data generated by
the application layer protocols across a
network.

Copyright © 2010, Elsevier Inc. All rights Reserved

2

Chapter 5

Internet protocol stack


application:

supporting network applications


FTP, SMTP, HTTP


transport:

process
-
process data transfer


TCP, UDP


network:

routing of datagrams from source to
destination


IP, routing protocols


link:

data transfer between neighboring
network elements


PPP, Ethernet


physical:

bits “on the wire”


application


transport


network


link


physical

transport

3

Chapter 5

ISO/OSI reference model


presentation:

allow applications to
interpret meaning of data, e.g.,
encryption, compression, machine
-
specific conventions


session:

synchronization,
checkpointing, recovery of data
exchange


Internet stack “missing” these layers!


these services,
if needed,

must be
implemented in application


needed?

application


presentation


session


transport


network


link


physical

4

Chapter 5

Problem


How to turn the host
-
to
-
host packet delivery
service from the network layer into a process
-
to
-
process communication channel

5

Chapter 5

Chapter Outline


Simple Demultiplexer (UDP)


Reliable Byte Stream (TCP)


6

Chapter 5

Chapter Goal


Understanding the demultipexing service


Discussing simple byte stream protocol


7

Chapter 5

End
-
to
-
end Protocols (transport)


Common properties that a transport protocol can
be expected to provide


Guarantees message delivery


Delivers messages in the same order they were sent


Delivers at most one copy of each message


Supports arbitrarily large messages


Supports synchronization between the sender and the
receiver


Allows the receiver to apply flow control to the sender


Supports multiple application processes on each host

8

Chapter 5

End
-
to
-
end Protocols


Typical limitations of the network layer on which
transport protocol will operate


Drop messages


Reorder messages


Deliver duplicate copies of a given message


Limit messages to some finite size


Deliver messages after an arbitrarily long delay

9

Chapter 5

End
-
to
-
end Protocols


Challenge for Transport Protocols


Develop algorithms that turn the less
-
than
-
desirable
properties of the underlying network into the high level
of service required by application programs

10

Chapter 5

Simple Demultiplexer (UDP)


Extends host
-
to
-
host delivery service of the
underlying network into a process
-
to
-
process
communication service


Adds a level of
demultiplexing
which allows
multiple application processes on each host to
share the network


No
other services are guaranteed!

What’s that?

11

Chapter 5

Simple Demultiplexer (UDP)

UDP Message Queue

12

Chapter 5

Simple Demultiplexer (UDP)

Format for UDP header (Note: length and checksum fields
should be switched)

Where have
you seen
that before?

How may
ports can be
represented?

13

Chapter 5

UDP Ports


What is a port?


an application
-
specific or process
-
specific software
construct serving as a communications endpoint in a
computer's host operating system…


…In plain English, the purpose of ports is to uniquely
identify different applications or processes running on a
single computer and thereby enable them to share a
single physical connection to a packet
-
switched network
like the Internet.



see
http://en.wikipedia.org/wiki/TCP_and_UDP_port

14

Chapter 5

Sockets

Computer

Physical
connection (e.g.
ethernet, RS232)

OS

application

Port

80

Port

5678

socket

IP: 147.129.30.2

15

Chapter 5

UDP Ports


How do you find ports?


Well
-
known


Port mapper


This software has well known port


Knows the ports associated with services

16

Chapter 5

Discovering used ports on a machine

use
netstat.exe

program (shipped with windows).



Start "DOS Command Prompt" using run
-
> cmd


type netstat

an and then press Enter,


use command "more" to stop when your listing contains to much lines (netstat
-
na | more).


Each line of netstat's listing contains these information:



* Protocol type
-

it can be TCP or UDP. Two sockets can use the same port number when they use different
protocols.


* Local Address
-

local IP address which is used. In most cases it is 0.0.0.0 (any = not bound to the specific
IP address. It can accept connection from any PC's interface). When IP address is specified then only
connection from interface with the same IP address are accepted.
The port number immediately follows
the IP address


Local Address field contains port number which is used to accept connection or receive UDP data.


* Foreign Address
-

address of PC on remote side. It will be displayed when connection is established.


* State
-

state of socket. You can see this states:


LISTENING
-

socket waits for connection (or data in case of UDP socket)


ESTABLISHED
-

connection to the remote side is established


CLOSE_WAIT, TIME_WAIT
-

socket waits for connection close or other type of negotiation.


To determine whether desired port number is already in use you must check Local Address field on all lines.

17

Chapter 5

Discovering used ports on a machine


Example:


TCP 0.0.0.0:25 0.0.0.0:0 LISTENING

Some application which uses port 25 (SMTP server port) is running. To use P+'s mail server you must
at first stop this application.


Notice:

When finding used (or free) port number stop Proxy+ first.

18

Chapter 5

Discovering used ports on a machine


On Linux:



Read the /etc/services file.


If you want the list of open ports, try netstat
-
nlp


Arguments:

n = show network addresses as numbers,

l = show listening sockets,

p = show pid and name of program


19

Chapter 5

Discovering used ports on a machine


On Macs:



Read the
/etc/services
file.


If you want the list of open ports, try



netstat

n | more


The port follows the IP address


20

Chapter 5

Reliable Byte Stream (TCP)


In contrast to UDP, Transmission Control
Protocol (TCP) offers the following services


Reliable


Connection oriented


Byte
-
stream service