Download Lecture 20: Transport layer

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

IEEE 802.1aq wikipedia , lookup

Point-to-Point Protocol over Ethernet wikipedia , lookup

AppleTalk wikipedia , lookup

CAN bus wikipedia , lookup

Distributed firewall wikipedia , lookup

Computer network wikipedia , lookup

RapidIO wikipedia , lookup

Airborne Networking wikipedia , lookup

Piggybacking (Internet access) wikipedia , lookup

Parallel port wikipedia , lookup

Asynchronous Transfer Mode wikipedia , lookup

Deep packet inspection wikipedia , lookup

Network tap wikipedia , lookup

Nonblocking minimal spanning switch wikipedia , lookup

TCP congestion control wikipedia , lookup

Wake-on-LAN wikipedia , lookup

I²C wikipedia , lookup

Zero-configuration networking wikipedia , lookup

IEEE 1355 wikipedia , lookup

Cracking of wireless networks wikipedia , lookup

Internet protocol suite wikipedia , lookup

Recursive InterNetwork Architecture (RINA) wikipedia , lookup

UniPro protocol stack wikipedia , lookup

Transcript
• Review:
– What functionality is supported by IP?
– What IP does not do?
– How many classes of IP addresses?
– Explain fields in an IP header?
– How subnet works?
– How classless Inter-domain routing work?
– What does an IP router do?
– What/why “longest matching”
• Chapter 6: The Transport layer.
– Very similar to the data link layer.
– two hosts connected by a link or two hosts connected by a
network
– differences:
– When two hosts are connected by a link, packets will not
reorder or duplicate (if the sender sends only once). In
addition, packets will either get to the receiver or get lost.
– When two hosts are connected by a network, packets can
be duplicated, delayed, lost, reordered.
– Implication: The problems to be addressed in the transport
layer are very similar to those in the data link layer.
However, the solutions may be more complex.
• The transport layer issues: service interface,
addressing, connection management, error control,
flow control, multiplexing/demultiplexing, quality
of service
– Service interface
• connection-oriented and connectionless.
• similar to the network layer. Why one more layer?
– network layer -- part of the communication subnet, run by
carrier. can't be changed.
– transport layer -- put one more layer on the hosts to get the
services needed
– potential problem: may do the same thing two times,
which can decrease the communication performance.
– Addressing
• Link: want to transfer data to Ethernet card 08.00.2b.2a.83.62
• Network: want to transfer data to IP host 128.2.222.85
• Transport: which entity you will try to address?
– want to talk to one process on host 128.2.222.85.
– what to do use? process ID? how many bits? What would
be the problem when using the pid as transport layer
identifier?
– Abstraction: port number
• Multiplexing/Demultiplexing
– upward multiplexing: multiplex different transport
connections onto the same network connection.
– downward multiplexing: open multiple network
connections for a single transport layer connection.
– Error Control.
• sliding window protocol
– Flow Control
• buffer size may need to be adjusted for from time to
time (variable size window)
• two ways to inform the sender:
– window-based: receiver tells sender a window-size
– rate-based: receiver tells sender a rate.
– Connection Management
• How to tell the start and the end of a logical connection?
– Can be quite tricky: consider this bank transaction example
»
»
»
»
(a) setup connection
(b) transfer $100
(c) close connection
all messages are delayed and replayed.
• Solution 1:
– assign a connection-id to each connection, the receiver
keeps track what connections have been terminated.
» How many connection-ids to keep?
» What if receiver crashs and comes back again? It
forgets what connections have been established?
• Solution 2:
– Assuming that if a packet dies at t, and the effect will die
at t+T.
– Use different initial sequence numbers (ISN) for each
connection.
» Need to make sure that the sequence number has not
been used in the previous session (or the packet with
that sequence number has died).
• How to choose Initial Sequence number.
– A clock runs continuously, use the lower k-bit as the ISN.
– Host A port 10 talk to host B port 12, 8 bits sequence number,
increments every 1 sec. Consider this situation:
» A starts at time 100, choose ISN 100, sends 150 packets
crashed.
» A reboots at time 200 and, use local port 10 and connect to
host B port 12, choose ISN 200
» Packets 200 - 250 from previous connection may be
replayed
• How to make sure that the sequence numbers do not overlap?
– forbidden zone.
» don't generate sequence numbers faster than the clock of
ISN.
» can also come from beneath
– wait for 2*MSL after crash before setting new connections
• Connection termination:
– sender “disconnect”, waiting for receiver’s disconnection
– receiver “disconnect”, waiting for sender’s acknowledge
– after getting receiver’s “disconnect” packet, sender “acks”.
– Problem?
» the three army problem.
• Service primitives for TCP:
– socket: create a new communication end point
#include <sys/socket.h>
int socket(int domain, int type, int protocol);
domain: AF_UNIX
file system
AF_INET
internet address
type: SOCK_STREAM
reliable connect-oriented, byte
stream
SOCK_DGRAM
unreliable connectionless
SOCK_SEQPACKET record stream
protocol: 0, non-zero for a specific protocol
– bind: attach an address to a socket
int bind(int socket, const struct sockaddr *address, size_t
address_len)
address: contains the port number, address.sin_port
• Service primitives for TCP:
– listen: announce willingness to accept connections
int listen(int socket, int backlog);
backlog: number of outstanding connections in the listen queue
– accpet: accept a new connection on a socket
int accept (int socket, struct sockaddr *address, size_t *address_len);
address: the address of the connecting socket
– connect: try to establish a connection
int connect(int socket, const struct sockaddr *address, size_t
address_len);
address: the destination address
– write: send data
ssize_t write(int fildes, const void *buf, size_t nbyte);
– read: receive data
ssize_t read(int fildes, void *buf, size_t nbyte);
– close: close a connection
int close(int fildes);