صفحه 1:
Chapter 6
The Transport Layer
صفحه 2:
The Transport Service
Services Provided to the Upper
Layers
Transport Service Primitives
Berkeley Sockets
An Example of Socket
Programming:
- An Internet File Server
صفحه 3:
Services Provided to the Upper
Layers
Host 1 Host 2
Application Application
{orsession) Application’transport (or session}
layer Transport | interface layer
address
TPDU
Transport | Transport
تم
entity | ‘Transport entity
protocol
+
Network
Transporvinetwork تیم
Network layer سس Network layer
The network, transport, and application layers.
صفحه 4:
Transport Service Primitives
Primitive Packet sent Meaning
LISTEN (none) Block until some process tries to connect
CONNECT CONNECTION REQ. Actively attempt to establish a connection
SEND DATA Send information
RECEIVE (none) Block until a DATA packet arrives
DISCONNECT | DISCONNECTION REQ. | This side wants to release the connection
The primitives for a simple transport service.
صفحه 5:
Transport Service Primitives
(2)
Frame Packet TPDU
header header header
7 ص
TPDU payload
0 سم
Frame payload
The nesting of TPDUs, packets, and frames.
صفحه 6:
Transport Service Primitives
(3)
ات 7
Connection request
TROU recelved
i
PASSIVE ACTIVE
lesTAsLiSHNeNt| ESTABLISHMENT
PENDING PENDING
(Connect primitive Connection accepted
‘eects POU received
Disconnect
a ‘ACTIVE
saci DISCONNECT |
PENDING
تا “| HE | -“Disconnestonreqoosr
primitive executed TPOU racoWved
A state diagram for a simple connection management
scheme. Transitions labeled in italics are caused by
packet arrivals. The solid lines show the client's
state sequence. The dashed lines show the server's
وج سم سس اوه
صفحه 7:
Berkeley Sockets
Meaning
Create a new communication end point
Attach a local address to a socket
‘Announce willingness to accept connections; give queue size
Block the caller until a connection attempt arrives
Actively attempt to establish a connection
Send some data over the connection
Receive some data from the connection
Release the connection
Primitive
SOCKET
BIND
LISTEN
ACCEPT
CONNECT
SEND
RECEIVE
CLOSE
The socket primitives for TCP.
صفحه 8:
(This page contains efent program that can request fle rom the server program
* on the ext page. The server responds by sencing the whol te
‘include <systypes.h>
finclude <sysisocket >
n> مه
‘include <netdb hs
‘tootine SERVER_PORT 12345, ‘+ arbitrary, but clent& server must agree +)
‘#dotine BUF SIZE 4096 1+ Block ranster size +!
Int malik arge, char *"argv)
1
inte, s, byes:
char bufBUF size} 1 butler or incoming fle +!
Stuck hostent sh "info about server»!
struct sockaderin channet ‘+ holds I aaress */
if (arge!= 3) fatal"Usage: cient server-name fle-name')
| ‘+ ook up host's IP address «/
if Qh fatal¢gothostbynamo failed’);
ockel(PF_INET, SOCK STREAM, IPPROTO TCP):
i (s-0) fatalsocket’
] sizeot(channel)
channelsin famiy= AF_INET;
Imemepy(Gchannelsin adds ager, oh ade ht length
Channel ی
‘onnects (struct sockaddr ») channel, sizeot{channe)
if{e-<0) fatal(connect fates:
/ Connection is now established. Send file name including 0 byte at end. +!
writs, argv2,srlon(argt2}+1)
Go get the fe and wre to standard ouput. اه
۷ 0
|
A (oytas <= 0) ext} 1s check for end offi +!
ito, ut, bytes) 1+ wre to standara output +!
)
1
۳
1
rina", sing)
ext)
5
Socket
Programmin
g Example:
Internet File
Server
Client code using
sockets.
صفحه 9:
۳ 3
هه esysenth>
|
۳
‘into enol he
‘cine SERVER_PORT 12345 arbiter, but ent & sewer must agree +)
Adeline BUF_SiZE 4086 oc raster ie
‘eine QUEUE SZE 10
ivan are ca“)
Int فلا 50 bytes, on = 1:
با از و مه outgoing te»!
Struct sockaddr In char ‘hls acess»
1+ But acess stro ta bind to socket. »/
memsetchannet 0, szel(channa), Ize channel +/
hanno. sin fay = AF_INET,
‘hanna shad adc» honiINADOA. ANY)
‘hanno sit_por = hlens(SERVER. PORT)
‘+ Passve open. Walt for connection, +
scoketAF-INET, SOCK STREAM, IPPROTO.TCP); + create sockot + و
1g) fatal socket ale
Setzockopfs, SOL-SOCKET, SO. REUSEADOR, (cher +) Son, casio):
= bins, (ctuct sockaddr») hanno, sizeo{channel
1 (20) faa be tea)
|etten(s, QUEUE. SIZE); J+ epeaty queue
1۱۱2 ۵( ماه هه
‘+ Sockot is now set up and Bound, Wal for connostion and procass اه
wn (1)
sa aecepts 0,0 + blak for eanneton request »/
(ga <0) fata‘accapt fale
reads, but, BUF SIZE) ‘tna te nam fom sockel +
J» Got and return he He»)
t= open, ©. ADONLY}; ‘open te eto be sent back +!
(Gd = 0 fataiepen tale)
ی
bye = reals, bu, BUF SIZE) road om fe +)
1 ytes <= 0} break "sched frond a le */
vwrio(sa, bu, bles: Jn we bytes to sockot
0
مجمه دز 16
ose) مج connection +!
Socket
Programmin
g Example:
Internet File
Server (2)
Client code using
sockets.
صفحه 10:
Elements of Transport
Protocols
° Addressing
¢ Connection Establishment
* Connection Release
° Flow Control and Buffering
۰ Multiplexing
۰ Crash Recovery
صفحه 11:
Transport Protocol
Router Router Subnet
communication channel
Host
(a) (b)
(a) Environment of the data link layer.
(b) Environment of the transport layer.
صفحه 12:
Addressing
Host 2
Server®
\
TSAP i896
NSAP
Sener
Applicaton 35
مو سم
layer
“Transport
layer
Network
layer
Data ink
layer
Physical
layer
transport connections.
Host 1
Application Oo” 1208
process
سس
۳
TSAPs, NSAPs and
صفحه 13:
Connection Establishment
Host 4 Host2
ime»
رهم
server)
© |
سم @
How a user process in host 1 establishes a
connection with a time-of-day server in host 2.
صفحه 14:
Connection Establishment (2)
T 2
Forbidden بح
2 _| message
Bor g
2 x g
5 s 8
3 Restart after 5
& Oe crash with 70 8
0
‘Actual sequence
é رب بيك numbers used
0 30 60 90 120 150 0
Time Time
(a) 0
(a) TPDUs may not enter the forbidden region.
(b) The resynchronization problem.
صفحه 15:
Connection Establishment (3)
Three protocol scenarios for establishing a
connection using a three-way handshake. CR
denotes CONNECTION REQUEST.
(a) Normal operation,
(b) Old CONNECTION REQUEST appearing out of
nowhere.
(c) Duplicate CONNECTION REQUEST and
duplicate ACK.
صفحه 16:
Connection Release
Host 1 Host 2
| هس
pack
DATA
DATA
08 سح
No data are
delivered after
a disconnect
request
Time
Abrupt disconnection with loss of data.
صفحه 17:
Connection Release (2)
& Wit army
Ay
The two-army problem.
صفحه 18:
Connection Release (3)
Host 1 Host 2 Host 1 Host 2
Send DR DR Send DR OR
+ start timer a + start timer pe
Seed DE Send DR
9۶ و | ای + sta ier
Release Feleass
connection یتست
| گس همجمج
sensack LACK | | مه
روف کش connection
مس
connection
(a) (b)
Four protocol scenarios for releasing a connection. (a) Normal
case of a three-way handshake. (b) final ACK lost.
صفحه 19:
Connection Release (4)
Host 2
Send DR &
start timer
ctimbout
release
connection
ات
| عفر
کر
(d)
Host 1
Send DR
+ start timer
(Tinfeout)
send DR
+ start timer
(N Tinfeouts))
release
connection
ost and
Host 2
Send DR &
start timer
Send DR &
start timer
Release
connection
ponse
ل
—
ee |
»تفت
Host 1
Send DR
+ start timer
(Timeout)
send DR
+ start timer’
Release
connection
Send ACK
(co)
(c) Response lost. (d) Res:
subsequent DRs lost.
صفحه 20:
Flow Control and Buffering
۱
J
0
۱ Trou 4
Unused
space
\
(a) Chained fixed-size buffers. (b) Chained variable-
sized buffers.
(c) One large circular buffer per connection.
صفحه 21:
Flow Control and Buffering (2)
‘Comments,
A wants 8 buffers
B grants messages 0-3 only
Anas 3 buffers left now
Anas 2 buffers left now
Message lost but A thinks it has 1 left
B acknowledges 0 and 1, permits 2-4
Anas 1 buffer left
Abas 0 buffers left, and must stop
A times out and retransmits
Everything acknowledged, but A still locked
‘A may now send 5
B found a new buffer somewhere
Abas 1 buffer left
Ais now blocked again
Ais still blocked
Potential deadlock
B
۱14
۱۱۱۱۱۱۱ ۱ ۱
The arrows show the direction
of transmission. An ellipsis (...) indicates a lost TPDU.
A Message
1 + «request 8 bufters>
2 سم <ack=15,buf=4>
3 حت «seq=0, data = mo>
4 + <seq=1,data=mt>
عد و «seq=2, data =m2>
6 - <ack = 1, buf =3>
7 + <seq=3, data =m3>
و —+ — «seq=4,data=m4>
و —~ — <seq=2, data =m2>
10 لم <ack=4, buf = 0>
"+ ack = 4, buf = 1>
12 اله <ack=4, buf=2>
18 —* — <seq=5, data = m5>
14 حا <seq=6, data = mé>
15 -— — <ack=6, buf =0>
16 +++ <ack=6, buf=4>
Dynamic buffer allocation.
صفحه 22:
Multiplexing
Transport address
۰ ۰ ۰
Network
matters سر
۰
Se ge
Router lines
To router
(a) (b)
(a) Upward multiplexing. (b) Downward multiplexing.
صفحه 23:
Crash Recovery
Strategy used by receiving host
First ACK, then write First_write, then ACK
Strategy used by
sending host ACWW) AWC —CAW) = CWA), = WAC WEA)
Always retransmit ok uP OK 9 pup | عنام
Never retransmit Lost | ok | Lost ۱8۲ | Ok OK
Retransmit in SO OK ملام | 1057 Lost | DUP 9
Retransmit in St Lost | 0k OK OK 0 DUP
OK _ = Protocol functions correctly
DUP_ = Protocol generates a duplicate message
LOST = Protocol loses a message
Different combinations of client and server strategy.
صفحه 24:
A Simple Transport Protocol
¢ The Example Service Primitives
¢ The Example Transport Entity
° The Example as a Finite State
Machine
صفحه 25:
The Example Transport Entity
Network packet Meaning
CALL REQUEST Sent to establish a connection
CALL ACCEPTED Response to CALL REQUEST
CLEAR REQUEST Sent to release a connection
CLEAR CONFIRMATION | Response to CLEAR REQUEST
DATA Used to transport data
CREDIT Control packet for managing the window
The network layer packets used in our example.
صفحه 26:
The Example Transport Entity
(2)
Each connection is in one of seven states:
Idle - Connection not established yet.
Waiting - CONNECT has been executed, CALL
REQUEST sent.
Queued - A CALL REQUEST has arrived; no LISTEN
yet.
Established - The connection has been established.
Sending - The user is waiting for permission to send a
packet.
Receiving - A RECEIVE has been done.
DISCONNECTING - a DISCONNECT has been done
locally.
1
2
صفحه 27:
The Example Transport Entity
£23.
fidefine MAX_CONN 32 J* max number of simultaneous connections */
define MAX_MSG_SIZE 8192 J+ largest message in bytes */
define MAX_PKT SIZE 512 J+ largest packet in bytes +/
tidefine TIMEOUT 20,
fidefine CRED 1
define OK 0
fidefine لالع همع
fidefine ERR_REJECT -2
fidefine ERR_CLOSED -3
fidefine LOW_ERR -3
typedef int transport_address;
typedef enum {CALL_REQ,CALL_ACC,CLEAR_REQ,CLEAR_CONF,DATA_PKT,CREDIT) pkt type;
typedef enum (IDLE, WAITING, QUEUED,ESTABLISHED,SENDING RECEIVING, DISCONN) cstate;
* Global variables. */
transport_address listen_address; ‘I local address being listened to */
int listen_conn; J connection identifier for listen */
unsigned char data[MAX PKT SIZE]; _/* scratch area for packet data */
struct conn {
transport_address local_address, remote_address;
cstate stat ‘state of this connection +/
unsigned char *user_but_addr; J» pointer to receive buffer */
int byte_count; J sendireceive count »/
int cr_req_received; J set when CLEAR_REQ packet received */
int timer I used to time out CALL_REQ packets */
int credits; ‘J number of messages that may be sent +/
} conn[MAX_CONN + 1]; + slot 0 is not used */
صفحه 28:
The Example Transport Entity
(4)
void sleep(void); * prototypes */
void wakeup(void);
void to_net{int cid, int q, int m, pkt_type pt, unsigned char tp, int bytes):
void from_net(int *cid, int +g, int *m, pkt type *pt, unsigned char «p, int *bytes);
int listen(transport_address t)
{/* User wants to listen for a connection. See if CALL_REQ has already arrived. */
inti, found
for (i = 1; 1 <= MAX_CONN; i++) + search the table for CALL_REQ */
if (conn{i].state == QUEUED && connfij.local address == 1) {
found
break;
}
(found == 0) ) از
No CALL_REQ is waiting. Go to sleep until arrival or timeout. +/ */
listen_address =; sleep(); i= listen_conn ;
1
connfi}.state
connfilimer
:STABLISHED; /* connection is ESTABLISHED */
: /* timer is not used */
صفحه 29:
The Example Transport Entity
fe)
listen_conn, / is assumed to be an invalid address */
to_net(i, 0,0, CALL_ACC, data, 0); Js tell net to accept connection */
return(i; ع return connection identifier */
1
int connect(transport_address |, ransport_address r)
(User wants to connect to a remote process; send CALL_REQ packet. */
inti:
struct conn “cptr;
data[0]=*; datalt] J» CALL_REQ packet needs these اه
MAX_CONN; J» search table backward +/
while (conn[i].state != IDLE && i> 1)i=i 15
if (connfi} state == IDLE) {
‘/* Make a table entry that CALL_REQ has been sent. */
ptr = 806001:
cptr->local address = I; cptr->remote_address
optr->state = WAITING; cptr->clr_req_ received
cptr->credits = 0; cpt->timer = 0;
to_net(, 0, 0, CALL_REQ, data, 2);
sleep() ‘+ wait for CALL_ACC or CLEAR. REQ +/
if (cptr>state == ESTABLISHED) retumn();
if (optr>clr_teq_received) {
1+ Other side refused call. +/
cptr->stato = IDLE; J» back to IDLE stato */
to neti, 0, 0, CLEAR CONF, data, 0);
roturn(ERR_ REJECT);
}
else return(ERR_FULL); Js reject CONNECT: no table space */
۱
صفحه 30:
The Example Transport Entity
(6)
int send(int cid, unsigned char bufptr(), int bytes)
{/* User wants to send a message. */
inti, count, m;
struct conn *cptr = &conn{cid);
/* Enter SENDING state. 7
optr->state = SENDING;
cptr->byte_count = 0; J+ # bytes sent so far this message */
if (cptr->clr_req_received == 0 && cptr->credits == 0) sleep();
if (cptr->clr_req_received == 0) {
/ Credit available; split message into packets if need be. */
do{
if (bytes — cptr->byte_count > MAX_PKT_SIZE) {/* multipacket message */
count = MAX_PKT_SIZE; m= 1; /* more packets later */
Jelse { J+ single packet message */
count = bytes - cptr->byte_count; m=0; _/* last pkt of this message */
1
for (i = 0; i < count; i++) datafi] = bufptr{cptr->byte_count + i];
to_net(cid, 0,m, DATA_PKT, data, count); /* send 1 packet */
cptr->byte_count = cptr->byte_count + count; /* increment bytes sent so far */
} while (cptr->byte_count < bytes); _/* loop until whole message sent */
صفحه 31:
The Example Transport Entity
(7)
optr->credits / * each message uses up one credit */
optr>state
return(OK);
Jelse (
optr->state = ESTABLISHED;
return(ERR_CLOSED); /* send failed: peer wants to disconnect */
1
1
int receive(int cid, unsigned char bufptr[], int +bytes)
{/" User is prepared to receive a message. */
struct conn *cptr = &conn|cid];
it (optr->olr_req_received == 0) {
/* Connection stil established; try to receive. */
optr->state = RECEIVING;
optr->user_but_addr = bufptr;
optr->byte_count = 0;
data[0] = CRED;
datalt
to_net(cid, 1,0, CREDIT, data, 2); /* send credit »/
sleep); + block awaiting data */
*bytes = optt->byte_count;
1
cptr->state = ESTABLISHED;
return(cptr->clr_req_received ? ERR_CLOSED : OK);
}
صفحه 32:
The Example Transport Entity
(8)
int disconnect(int cid)
{/ User wants to release a connection. */
struct conn *cptr = &conn{cid];
if (cptr->cir_req_received) { J+ other side initiated termination +/
optr-astate = IDLE; J+ connection is now released */
to_net(cid, 0, 0, CLEAR_CONF, data, 0);
}else { J we initiated termination */
cptr->state = DISCONN; J+ not released until other side agrees */
to_net(cid, 0, 0, CLEAR_REQ, data, 0);
1
return(OK);
}
Void packet_arrival(void)
{A packet has arrived, get and process it. */
int cid; J connection on which packet arrived +/
int count, i, q, m;
pkt_type ptype;_/* CALL_REQ, CALL ACC, CLEAR_REQ, CLEAR_CONF, DATA PKT, CREDIT */
unsigned char data[MAX_PKT_SIZE]; _/* data portion of the incoming packet */
struct conn *eptr;
from_net(&cid, &q, &m, &ptype, data, &count); /* go get it */
‘&connicid];
صفحه 33:
The Example Transport Entity
CON
J remote user wants to establish connection #/
datal1};
switch (ptype) (
‘case CALL_RE
‘optr->local_address = datal0]; optr->remote_addres:
if (cptr-slocal_address == listen_address) {
listen_conn = cid; cptr->state = ESTABLISHED; wakeup():
( )اه
عمجم
1
optr->clr_req_receiver
break:
‘case CALL_ACC: ] remote user has accepted our CALL_REQ */
optr-state = ESTABLISHED;
wakeup():
break:
case CLEAR_REQ: Js remote user wants to disconnect or reject call */
IMEOUT;
UEUED; optr->timer
0; cptr->credits = 0;
= IDLE; /* clear collision */
RECEIVING II cptr->state
if (eptr->state
it (eptr-sstate SENDING) wakeup();
J+ remote user agrees to disconnect +/
break:
case CREDIT: /* remote user is waiting for data */
ptr-scredits += datal1}:
it (cptr->state == SENDING) wakeup();
break;
‘case DATA_PKT: Js remote user has sent data +/
for (i = 0; | < count; i++) eptr->user_buf_addrfeptr-=byte_count + i] = datali);
optr-sbyte_count += count;
it (m == 0) wakeup);
صفحه 34:
The Example Transport Entity
(10)
}
void clock (void)
{/* The clock has ticked, check for timeouts of queued connect requests. */
inti
struct conn *optr;
for (i = 1; i <= MAX_CONN; i++) {
ptr = 00
if (cptr->timer > 0) ) /+ timer was running اه
cptr->timer—
if (optr->timer == 0) { J timer has now expired */
cptr->state = IDLE;
to_net(i, 0, 0, CLEAR_REQ, data, 0);
صفحه 35:
The Example as a Finite State
Riva
to __Wating _Quoued_Esabished Sending Recaiing comoting
۳۳"
At Sod Ga ae AF Seats
Viste Cal.feq A Walt tar ret
8: Son al
1: St
‘0: Set Cr rq. recive tag
2s: Send Czar cont At Record erect
| 5000 90 212 و ا
عم
Pt: connection tabi
امس
مركن
‘SEND
RECEWE
مه
مه
مرسمه
سس
nein pets
81
The example protocol
as a finite state
machine. Each entry
has an optional
predicate, an optional
action, and the new
state. The tilde
indicates that no major
action is taken. An
overbar above a
predicate indicate the
negation of the
predicate. Blank
entries correspond to
صفحه 36:
The Example asa Finite State
connect هد
oe
GER RES CALL REG
warn مه
CALL ACC. uisreN
| estan.
creo, | USHeD | receve
6 ‘CLEAR REQ. 1
5
seno_)$) مس
ممص وريد | هو
1
oiscon
NecTING
CLEAR REO, CLEAR CONE
The example protocol in graphical form.
Transitions that leave the connection state
mnnhannroan Katia Aoan Amittand far oimmnlinitr
صفحه 37:
The Internet Transport
Protocols: UDP
٠ Introduction to UDP
۰ Remote Procedure Call
¢ The Real-Time Transport
Protocol
صفحه 38:
Introduction to UDP
Destination port
UDP checksum,
32 Bits
The UDP header.
Source port
UDP length
صفحه 39:
Remote Procedure Call
Client CPU Server CPU
7 Client Server,
1 stub stub
Client Server
— 2 4
Operating system ¥ 4 Operating system
له سا
Network
Steps in making a remote procedure call. The stubs are
shaded.
صفحه 40:
The Real-Time Transport
Protocol
Ethernet IP UDP ۳
Multimedia application| ا header pester header
RTP
Socket interface RTP payload
UDP
م |+—— UDP payload ——+|
Ethernet + ۱۳ payload أحج
|+—— Ethernet payload ——_——+|
(a) (b)
User
space
os
Kernel
(a) The position of RTP in the protocol stack. (b) Packet
nesting.
صفحه 41:
The Real-Time Transport
Protocol (2)
32 bits
1 1۱۱۱۲۱ ۱۱۱۱۲۲۲۷۱۱۱۲۱۲۳۱ ۱۲۱
Ver. |P|x| Cc |M| Payload type ‘Sequence number
Timestamp
Synchronization source identifier
Contributing source identifier
The RTP header.
صفحه 42:
The Internet Transport
Protocols: TCP
duction to TCP
[CP Service Model
[CP Protocol
[CP Segment Header
Intro
The 7
The 1
The 7
TCP Connection Establishment
TCP Connection Release
TCP Connection Management Modeling
TCP Transmission Policy
TCP Congestion Control
TCP Timer Management
Wireless TCP and UDP
Transactional TCP
صفحه 43:
The TCP Service Model
Port _| Protocol Use
21 FIP File transfer
23 Telnet. Remote login
25 SMTP. E-mail.
69 TFTP Trivial File Transfer Protocol]
9 Finger Lookup info about a user
80 HTTP World Wide Web
110 POP-3 emote e-mail access
119 NNTP USENET news
Some assigned ports.
صفحه 44:
The TCP Service Model (2)
ABCD
IP header TCP header
يا
8
۸
(a) Four 512-byte segments sent as separate IP datagrams.
(b) The 2048 bytes of data delivered to the application in a
single READ CALL.
صفحه 45:
The TCP Segment Header
32 Bits
Source port Destination port
Sequence number
‘Acknowledgement number
Tor ۸/۴
header 8۱55| ۷|۱ Window size
length ۵۲۱۷۸
Checksum Urgent pointer
Options (0 or more 32-bit words) 2
1 Data (optional)
TCP Header.
۳
صفحه 46:
The TCP Segment Header (2)
32 Bits
ربا یبا نير
Source address
Destination address
00000000 Protocol = 6 TCP segment length
The pseudoheader included in the TCP checksum.
صفحه 47:
TCP Connection Establishment
Host 2
Host2 Host 1
SYN (SE0~ 5
Host 1
Seon [|
sea =¥)
snes
5
نو
هر
em seo
Time
SAA HACK ey 41)
0
(a)
(a) TCP connection establishment in the normal case.
(b) Call collision.
صفحه 48:
TCP Connection Management
Modeling
State Description
CLOSED No connection is active or pending
LISTEN The server is waiting for an incoming call
SYN RCVD ‘A connection request has arrived; wait for ACK
SYN SENT The application has started to open a connection
ESTABLISHED | The normal data transfer state
FIN WAIT 1 The application has said it is finished
FIN WAIT 2 The other side has agreed to release
TIMED WAIT _| Wait for all packets to die off
CLOSING Both sides have tried to close simultaneously
CLOSE WAIT _| The other side has initiated a release
LAST ACK Wait for all packets to die off
The states used in the TCP connection management finite
state machine.
صفحه 49:
TCP Connection Management
Modeling (2)
\CONNECTISYN (Sep ofthe ay handel)
close
sent
{Sip St he Say Fresh)
022-50
همه
(ata vance state)
ESTABLISHED
50-1
{evoane |
iw
سم همه [
0
مه
کر
sens م سلیم
۸
همه
TCP connection
management finite
state machine. The
heavy solid line is the
normal path for a
client. The heavy
dashed line is the
normal path for a
server. The light
lines are unusual
events. Each
transition is labeled
by the event causing
it and the action
resulting from it,
صفحه 50:
Sender Receiver Receivers
buter
9 4k
Empty
Se
Se
|-_——{nox = 28 Wi = 2088}
7
Te
:
Ful
Senders
Posted
متهم اميم
2
Window management in TCP.
pplication
‘oes 82 أ
TCP Transmission Policy
۳
‘does a2 أ
a
wet
Sender may.
send up to2K —
صفحه 51:
TCP Transmission Policy (2)
56061605 is full
Application reads 1 byte
[== Roam for ane more byte
Reader Window update segment sent سم
New byte arrives
Receivers buffer is full
Silly window syndrome.
صفحه 52:
TCP Congestion Control
Fate agustment
Lagecapacty = رت
~
3 0
(a) A fast network feeding a low capacity receiver.
(b) A slow network feeding a high-capacity receiver.
صفحه 53:
TCP Congestion Control (2)
Timeout
x
‘Threshold
Threshold
Congestion window (kilobytes)
o 2 4 6 8 0 2 14 16 18 2 22 2
Transmission number
An example of the Internet congestion algorithm.
صفحه 54:
TCP Timer Management
9 1 93 9 Te
92
Probability
Probability
8
2
o 10 2 30 40 50 °o “qo 20 30 0
Round-trip time (msec) Round-trip time (msec)
8 (b)
(a) Probability density of ACK arrival times in the data
link layer.
(b) Probability density of ACK arrival times for TCP.
صفحه 55:
Wireless TCP and UDP
Sender TCP #1 Base
station
TCP #2
کار
host
Router Antenna
Splitting a TCP connection into two connections.
صفحه 56:
Transitional TCP
Client Server Client Server
1 1
|] sw.
‘SYN, request, Fin
y— 2
|. —svn, ACKISYN 2
gy, ACK(FIN), ro: FIN
3
3 لب ۸0165۷۸۷
Time لب أ Time
|
|. ackiveauest + FN)
fa) (b)
(a) RPC using normal TPC.
(b) RPC using T/TCP.
صفحه 57:
Performance Issues
Performance Problems in Computer
Networks
Network Performance Measurement
System Design for Better
Performance
Fast TPDU Processing
Protocols for Gigabit Networks
صفحه 58:
Performance Problems in Computer
Networks
The state of transmitting one megabit from San Diego to Boston
(a) Att =0, (b) After 500 psec, (c) After 20 msec, (d) after 40 msec.
صفحه 59:
Network Performance
Measurement
The basic loop for improving network
performance.
1. Measure relevant network parameters,
performance.
2. Try to understand what is going on.
3. Change one parameter.
صفحه 60:
System Design for Better
Performance
Rules:
1. CPU speed is more important than network
speed.
2. Reduce packet count to reduce software
overhead.
Minimize context switches.
Minimize copying.
You can buy more bandwidth but not lower delay.
Avoiding congestion is better than recovering
from it.
7. Avoid timeouts.
Soe S
صفحه 61:
System Design for Better
Performance (2)
o of 02 08 04 05 06 07 08 09 10
Load
Response as a function of load.
صفحه 62:
System Design for Better
Performance (3)
User process running at the Network Receiving
time of the packet arrival manager process
User space
ol 5/19 9 —
OK
Four context switches to handle one packet
with a user-space network manager.
صفحه 63:
Fast TPDU Processing
|= Sending Receiving process —. “ay
9 process ‘TPDU passed to the receiving process 1
|+— Trap into the kernel to send TPDU
مر
|
The fast path from sender to receiver is shown with a heavy line.
The processing steps on this path are shaded.
Network
صفحه 64:
Fast TPDU Processing (2)
Source port Destination port ver. | IHU] TOs Total length
Sequence number Identification Fragment offset
‘Acknowledgement number TTL | Protocol || Header checksum
Len |Unused Window size Source address,
Checksum Urgent pointer Destination address.
2 (b)
(a) TCP header. (b) IP header. In both cases, the shaded
fields are taken from the prototype without change.
صفحه 65:
Fast TPDU Processing (3)
Slot
Pointer to list of timers for T + 12
=—— Current time, T
Pointer to list of timers for T +3
Pointer to list of timers for T + 10
A timing wheel.
صفحه 66:
Protocols for Gigabit Networks
1000 sec
100 sec
10sec
1 sec
100 msec
10 msec
1 msec
10? 104 105 1058 107 10810 109 1010 02
Data rate (bps)
Time to transfer and acknowledge a 1-megabit file over a
4000-km line.