0% found this document useful (0 votes)
29 views

Computer Networks Lab Manual

Anna University Lab Manual
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views

Computer Networks Lab Manual

Anna University Lab Manual
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 56

Ex.

no:1(a)
Date :
IMPLEMENTATION OF TCP SOCKETS (DATE & TIME SERVER)
A I M :
To implement date and time display from local host to server using TCP
A L G O R I T H M : C L I E N T
1. tart the program
!. "nclude necessary pac#age in $ava
%. Create a soc#et in client to server.
&. The client connection accept to the server and replay to read the system date and time.
'. top the program.
A L G O R I T H M : S E R V E R
1. tart the program
!. "nclude necessary pac#age in $ava
%. Create a soc#et in server to client.
&. Display the current date and time to client
'. top the program
SERVER PROGRAM:
import $ava.net.()
import $ava.io.()
import $ava.util.()
pu*lic class daytimeserver
+
pu*lic final static int DE,-./T0P12T31%)
pu*lic static void main(tring args45)
+
int port3DE,-./T0P12T)
if(args.length67)
+
try
+
port3"nteger.parse"nt(args475))
1
if(port8799port63:''%')
+
ystem.out.println(;the port num*er should *e *et<een 7 = :''%';))
return)
>>
catch(?um*er,ormatException e)
+
>
>
try
+
erveroc#et server3ne< erveroc#et(port))
oc#et connection3null)
<hile(true)
+
try
+
connection3server.accept())
@riter out3ne< 1utputtream@riter(connection.get1utputtream()))
Date no<3ne< Date())
out.<rite(no<.totring()A;BrBn;))
out.flush())
connection.close())
>
catch("1Exception ex)
+>
finally
+
try
+
if(connectionC3null)
connection.close())
>
catch("1Exception ex)
+>>>>
catch("1Exception ex)
+
ystem.err.println(ex))
>>>
2
CLIENT PROGRAM:
import $ava.net.()
import $ava.io.()
pu*lic class daytimeclient
+
pu*lic static void main(tring args45)
+
tring hostname)
if(args.length67)
+
hostname3args475)
>
else
+
hostname3;1!D.7.7.1;)
>
try
+
oc#et thesoc#et3ne< oc#et(hostnameE1%))
"nputtream timetream3thesoc#et.get"nputtream())
tringFuffer time3ne< tringFuffer())
int c)
<hile((c3timetream.read())C3G1)
time.append((char) c))
tring timestring3time.totring().trim())
ystem.out.println(;it is ; A timestring A ;at ;Ahostname))
>
catch(.n#no<nHostException ex)
+
ystem.err.println(ex))
>
catch("1Exception ex)
+
ystem.err.println(ex))
>
>
>
3
OUTPUT:
RESULT:
Thus the program <as executed and the output <as verified.
4
EI:?1:1 (ii)
Date:
IMPLEMENTATION OF ECHO SERVER AND CLIENT USING TCP
A I M :
To implement echo client and server from local host to server using TCP
A L G O R I T H M : C L I E N T
1. tart the program
!. "nclude necessary pac#age in $ava
%. Create a soc#et in client to server.
&. The client connection accepts to the server and replay to read the system.
'. top the program.
A L G O R I T H M : S E R V E R
1. tart the program
!. "nclude necessary pac#age in $ava
%. Create a soc#et in server to client.
&. Display the current client data.
'. top the program
ECHOSERVER PROGRAM:
import $ava.io.()
import $ava.net.()
pu*lic class Echoerver
+
pu*lic static void main(tring args45) thro<s Exception
+
try
+
int Port)
5
Fuffered2eader Fuf 3ne< Fuffered2eader(ne< "nputtream2eader(ystem.in)))
ystem.out.print(; Enter the Port -ddress : ; ))
Port3"nteger.parse"nt(Fuf.read/ine()))
erveroc#et so# 3ne< erveroc#et(Port))
ystem.out.println(; erver is 2eady To 2eceive a Jessage. ;))
ystem.out.println(; @aiting ..... ;))
oc#et so3so#.accept())
if(so.isConnected()33true)
ystem.out.println(; Client oc#et is Connected uccecfully. ;))
"nputtream in3so.get"nputtream())
1utputtream ou3so.get1utputtream())
Print@riter pr3ne< Print@riter(ou))
Fuffered2eader *uf3ne< Fuffered2eader(ne< "nputtream2eader(in)))
tring str3*uf.read/ine())
ystem.out.println(; Jessage 2eceived ,rom Client : ; A str))
ystem.out.println(; This Jessage is ,or<arded To Client. ;))
pr.println(str))
pr.flush())
>
catch(Exception e)
+
ystem.out.println(; Error : ; A e.getJessage()))
>>>
ECHOCLIENT PROGRAM:
import $ava.io.()
import $ava.net.()
pu*lic class EchoClient
+
pu*lic static void main(tring args45) thro<s Exception
+
try +
int Port)
Fuffered2eader Fuf 3ne< Fuffered2eader(ne< "nputtream2eader(ystem.in)))
ystem.out.print(; Enter the Port -ddress : ; ))
6
Port3"nteger.parse"nt(Fuf.read/ine()))
oc#et so#3ne< oc#et(;localhost;EPort))
if(so#.isConnected()33true)
ystem.out.println(; erver oc#et is Connected uccecfully. ;))
"nputtream in3so#.get"nputtream())
1utputtream ou3so#.get1utputtream())
Print@riter pr3ne< Print@riter(ou))
Fuffered2eader *uf13ne< Fuffered2eader(ne< "nputtream2eader(ystem.in)))
Fuffered2eader *uf!3ne< Fuffered2eader(ne< "nputtream2eader(in)))
tring str1Estr!)
ystem.out.println(; Enter the Jessage : ;))
str13*uf1.read/ine())
pr.println(str1))
pr.flush())
ystem.out.println(; Jessage end uccessfully. ;))
str!3*uf!.read/ine())
ystem.out.println(; Jessage ,rom erver : ; A str!))
>
catch(Exception e)
+
ystem.out.println(; Error : ; A e.getJessage()))
> > >
7
OUTPUT:
ECHOSERVER:
ECHOCLIENT
RESULT:
Thus the program <as executed and the output <as verified.
8
EI.?1:1(iii)
Date:
IMPLEMENTATIONOF REMOTE COMMAND EXECUTION USING TCP
A I M :
To implement remote command execution from local host to server using TCP
A L G O R I T H M : C L I E N T
1. tart the program
!. "nclude necessary pac#age in $ava
%. Create a soc#et in client to server.
&. The client connection accepts to the server and replay to read the system.
'. top the program.
A L G O R I T H M : S E R V E R
1. tart the program
!. "nclude necessary pac#age in $ava
%. Create a soc#et in server to client.
&. Display the current client data.
'. top the program
REMOTESERVER PROGRAM:
import $ava.io.()
import $ava.net.()
class 2emoteerver
+
pu*lic static void main(tring args45)
+
try
+
int Port)
Fuffered2eader Fuf 3ne< Fuffered2eader(ne<
"nputtream2eader(ystem.in)))
9
ystem.out.print(; Enter the Port -ddress : ; ))
Port3"nteger.parse"nt(Fuf.read/ine()))
erveroc#et ss3ne< erveroc#et(Port))
ystem.out.println(; erver is 2eady To 2eceive a Command. ;))
ystem.out.println(; @aiting ..... ;))
oc#et s3ss.accept())
if(s.isConnected()33true)
ystem.out.println(; Client oc#et is Connected uccecfully. ;))
"nputtream in3s.get"nputtream())
1utputtream ou3s.get1utputtream())
Fuffered2eader *uf3ne< Fuffered2eader(ne<
"nputtream2eader(in)))
tring cmd3*uf.read/ine())
Print@riter pr3ne< Print@riter(ou))
pr.println(cmd))
2untime H32untime.get2untime())
Process P3H.exec(cmd))
ystem.out.println(; The ; A cmd A ; Command is Executed uccessfully. ;))
pr.flush())
pr.close())
ou.close())
in.close())
>
catch(Exception e)
+
ystem.out.println(; Error : ; A e.getJessage()))
>
>
>
REMOTECLIENT PROGRAM
import $ava.io.()
import $ava.net.()
class 2emoteClient
10
+
pu*lic static void main(tring args45)
+
try
+
int Port)
Fuffered2eader Fuf 3ne< Fuffered2eader(ne<
"nputtream2eader(ystem.in)))
ystem.out.print(; Enter the Port -ddress : ; ))
Port3"nteger.parse"nt(Fuf.read/ine()))
oc#et s3ne< oc#et(;localhost;EPort))
if(s.isConnected()33true)
ystem.out.println(; erver oc#et is Connected uccecfully. ;))
"nputtream in3s.get"nputtream())
1utputtream ou3s.get1utputtream())
Fuffered2eader *uf3ne< Fuffered2eader(ne<
"nputtream2eader(ystem.in)))
Fuffered2eader *uf13ne< Fuffered2eader(ne<
"nputtream2eader(in)))
Print@riter pr3ne< Print@riter(ou))
ystem.out.print(; Enter the Command to *e Executed : ; ))
pr.println(*uf.read/ine()))
pr.flush())
tring str3*uf1.read/ine())
ystem.out.println(; ; A str A ; 1pened uccessfully. ;))
ystem.out.println(; The ; A str A ; Command is Executed uccessfully. ;))
pr.close())
ou.close())
in.close())
>
catch(Exception e)
+ ystem.out.println(; Error : ; A e.getJessage()))
> > >
11
OUTPUT:
REMOTE-SERVER:
REMOTE-CLIENT:
RESULT:
Thus the program <as executed and the output <as verified.
12
EI.?1:1(iv)
Date:
IMPLEMENTATION OF TALK (CHAT) USING TCP
A I M :
To implement client and server chat from local host to server using TCP
A L G O R I T H M : C L I E N T
1. tart the program
!. "nclude necessary pac#age in $ava
%. Create a soc#et in client to server.
&. The client connection accepts to the server and replay to read the system.
'. top the program.
A L G O R I T H M : S E R V E R
1. tart the program
!. "nclude necessary pac#age in $ava
%. Create a soc#et in server to client.
&. Display the current client data.
'. top the program
ChatSerer Pr!"ra#:
import $ava.io.()
import $ava.net.()
class Chaterver
+
pu*lic static void main(tring args45) thro<s Exception
+
try
+
int Port)
Fuffered2eader Fuf 3ne< Fuffered2eader(ne<
"nputtream2eader(ystem.in)))
13
ystem.out.print(; Enter the Port -ddress : ; ))
Port3"nteger.parse"nt(Fuf.read/ine()))
erveroc#et so# 3ne< erveroc#et(Port))
ystem.out.println(; erver is 2eady To 2eceive a Jessage. ;))
ystem.out.println(; @aiting ..... ;))
oc#et so3so#.accept())
if(so.isConnected()33true)
ystem.out.println(; Client oc#et is Connected uccecfully. ;))
"nputtream in3so.get"nputtream())
1utputtream ou3so.get1utputtream())
Print@riter pr3ne< Print@riter(ou))
Fuffered2eader *r13ne< Fuffered2eader(ne<
"nputtream2eader(ystem.in)))
Fuffered2eader *r!3ne< Fuffered2eader(ne<
"nputtream2eader(in)))
tring str)
<hile(true)
+
ystem.out.println(; Jesage ,rom Client : ; A *r!.read/ine() ))
ystem.out.print(; Enter the Jessage : ;))
str3*r1.read/ine())
pr.println(str))
pr.flush())
>>
catch(Exception e)
+
ystem.out.println(; Error : ; A e.getJessage()))
>>>
ChatC$%e&t Pr!"ra#:
import $ava.io.()
import $ava.net.()
class ChatClient
+
pu*lic static void main(tring args45) thro<s Exception
14
+
try
+
int Port)
Fuffered2eader Fuf 3ne< Fuffered2eader(ne<
"nputtream2eader(ystem.in)))
ystem.out.print(; Enter the Port -ddress : ; ))
Port3"nteger.parse"nt(Fuf.read/ine()))
oc#et so#3ne< oc#et(;localhost;EPort))
if(so#.isConnected()33true)
ystem.out.println(; erver oc#et is Connected uccessfully. ;))
"nputtream in3so#.get"nputtream())
1utputtream ou3so#.get1utputtream())
Print@riter pr3ne< Print@riter(ou))
Fuffered2eader *r13ne< Fuffered2eader(ne<
"nputtream2eader(in)))
Fuffered2eader *r!3ne< Fuffered2eader(ne<
"nputtream2eader(ystem.in)))
tring str)
<hile(true)
+
ystem.out.print(; Enter the Jessage : ;))
str3*r!.read/ine())
pr.println(str))
pr.flush())
ystem.out.println(; Jessage ,rom erver : ; A *r1.read/ine()))
>>
catch(Exception e)
+
ystem.out.println(; Error : ; A e.getJessage()))
>>>
15
OUTPUT:
CHATSERVER:
CHATCLIENT:
RESULT:
Thus the program <as executed and the output <as verified.
16
Ex.no:!(i)
Date :
IMPLEMENTATION OF UDP SOCKET
AIM:
To <rite a clientGserver application for chat using .DP
ALGORITHM: CLIENT
1. "nclude necessary pac#age in $ava
!. Create a soc#et in client to server.
%. The client esta*lishes a connection to the server.
&. The client accept the connection and to send the data from client to server and vice versa
'. The client communicate the server to send the end of the message
:. top the program.
ALGORITHM: SERVER
1. "nclude necessary pac#age in $ava
!. Create a soc#et in server to client
%. The server esta*lishes a connection to the client.
&. The server accept the connection and to send the data from server to client and vice versa
'. The server communicate the client to send the end of the message
:. top the program
CLIENT PROGRAM:
import $ava.io.()
import $ava.net.()
class udpclient
+
pu*lic static void main(tring args45) thro<s Exception
+
Fuffered2eader user0input 3 ne< Fuffered2eader( ne< "nputtream2eader(ystem.in)))
Datagramoc#et client0soc#et 3 ne< Datagramoc#et())
"net-ddress "P0add 3 "net-ddress.getFy?ame(;1!D.7.7.1;))
*yte out0data453ne< *yte417!&5)
tring str3user0input.read/ine())
out0data3str.getFytes())
DatagramPac#et Pac#et13ne< DatagramPac#et(out0dataEout0data.lengthE"P0addE1!%&))
client0soc#et.send(Pac#et1))
client0soc#et.close())
>>
17
SERVER PROGRAM:
import $ava.io.()
import $ava.net.()
class udpserver
+
pu*lic static void main(tring args45) thro<s Exception
+
Datagramoc#et server0soc#et3ne< Datagramoc#et(1!%&))
*yte in0data453ne< *yte417!&5)
<hile(true)
+
DatagramPac#et Pac#et!3ne< DatagramPac#et(in0dataEin0data.length))
server0soc#et.receive(Pac#et!))
tring str3ne< tring(Pac#et!.getData()))
ystem.out.println(str))
>>>
OUTPUT:
RESULT:
Thus the program <as executed and the output <as verified.
18
EI.?1:!(ii)
Date:
IMPLEMENTATION OF DNS USING UDP
AIM:
To @rite a $ava program to perform .DP soc#et programming.
ALGORITHM: CLIENT
1. "nclude necessary pac#age in $ava
!. Create a soc#et in client to server.
%. The client esta*lishes a connection to the server.
&. The client accept the connection and to send the data from client to server and vice versa
'. The client communicate the server to send the end of the message
:. top the program.
ALGORITHM: SERVER
1. "nclude necessary pac#age in $ava
!. Create a soc#et in server to client
%. The server esta*lishes a connection to the client.
&. The server accept the connection and to send the data from server to client and vice versa
'. The server communicate the client to send the end of the message
:. top the program
C$%e&t Pr!"ra#:
import $ava.io.()
import $ava.net.()
import $ava.util.()
class Clientdns1!
+
pu*lic static void main(tring args45)
+
try
+
Datagramoc#et client3ne< Datagramoc#et())
"net-ddress addr3"net-ddress.getFy?ame(;1!D.7.7.1;))
*yte45 send*yte3ne< *yte417!&5)
*yte45 receive*yte3ne< *yte417!&5)
Fuffered2eader in3ne< Fuffered2eader(ne< "nputtream2eader(ystem.in)))
ystem.out.println(;Enter the D1J-"? ?-JE or "P adress:;))
tring str3in.read/ine())
send*yte3str.getFytes())
DatagramPac#et sender3ne< DatagramPac#et(send*yteEsend*yte.lengthEaddrE1%7K))
client.send(sender))
19
DatagramPac#et receiver3ne< DatagramPac#et(receive*yteEreceive*yte.length))
client.receive(receiver))
tring s3ne< tring(receiver.getData()))
ystem.out.println(;"P address or D1J-"? ?-JE: ;As.trim()))
client.close())
>
catch(Exception e)
+
ystem.out.println(e))
>>>
Serer:
import $ava.io.()
import $ava.net.()
import $ava.util.()
class erverdns1!
+
pu*lic static void main(tring args45)
+
try
+
Datagramoc#et server3ne< Datagramoc#et(1%7K))
<hile(true)
+
*yte45 send*yte3ne< *yte417!&5)
*yte45 receive*yte3ne< *yte417!&5)
DatagramPac#et receiver3ne< DatagramPac#et(receive*yteEreceive*yte.length))
server.receive(receiver))
tring str3ne< tring(receiver.getData()))
tring s3str.trim())
"net-ddress addr3receiver.get-ddress())
int port3receiver.getPort())
tring ip453+;!7&.1'.!7.7;E;D&.1!'.&'.1K;>)
tring name453+;<<<.face*oo#.com;E;<<<.gmail.com;>)
for(int i37)i8ip.length)iAA)
+
if(s.eLuals(ip4i5))
+
send*yte3name4i5.getFytes())
DatagramPac#et sender3ne< DatagramPac#et(send*yteEsend*yte.lengthEaddrEport))
server.send(sender))
*rea#)
>
else if(s.eLuals(name4i5))
+
send*yte3ip4i5.getFytes())
DatagramPac#et sender3ne< DatagramPac#et(send*yteEsend*yte.lengthEaddrEport))
20
server.send(sender))
*rea#)
>>
*rea#)
>>
catch(Exception e)
+
ystem.out.println(e))
> >>
OUTPUT:
DNS SERVER:
DNS CLIENT:
RESULT:
Thus the program <as executed and the output <as verified.
21
Ex.no:%
Date :
IMPLEMENTATION OF RA' SOCKETS
(PACKET CAPTURING AND FILTERING)
AIM :
To implement programs using ra< soc#ets (li#e pac#et capturing and filtering)
ALGORITHM :
1. tart the program and to include the necessary header files
!. Define the pac#et length
%. Declare the "P header structure using TCPheader
&. .sing simple chec#sum process to chec# the process
'. .sing TCP B"P communication protocol to execute the program
:. -nd using TCPB"P communication to enter the ource "P and port num*er and Target "P
address and port num*er.
D. The 2a< soc#et () is created and accept the oc#et ( ) and end to ( )E -CM
N. top the program
Pr!"ra#
import $ava.io.()
import $ava.net.()
pu*lic class datagramdata
+
pu*lic static void main(tring args45)thro<s Exception
+
tring s3;net<or#;)
*yte data453s.getFytes())
try
+
"net-ddress id 3 "net-ddress.getFy?ame(;localhost;))
int port3D)
DatagramPac#et dp 3 ne< DatagramPac#et(dataEdata.lengthEidEport))
ystem.out.println(;the pac#et is addressed to ; Adp.get-ddress() A ;on port ; A
dp.getPort()))
ystem.out.println(;there are ; A dp.get/ength() A;*ytes of dataon the pac#et;))
>
catch(.n#no<nHostException e)
+
ystem.out.println(e))
>
>
>
22
OUTPUT:
RESULT:
Thus the -*ove programs using ra< soc#ets TCP B"P (li#e pac#et capturing and filtering) <as
executed and successfully.
23
Ex.no:&
Date :
IMPLEMENTATION OF REMOTE PROCEDURE CALL
AIM:
To implement the program using 2emote Procedure Call (2PC).
ALGORITHM
:1."nclude necessary pac#ages
!. .sing -dd client to get the t<o values
%..sing -dd server() to implement and Call the -dd server impl
&..sing pu*lic interface to call the program in remotely
'.,inally to call and compile all the su* program
:.To Execute tart 2J" registry
PROGRAM:
RMI Serer I&ter(a)e Pr!"ra#
import $ava.rmi.()
pu*lic interface 2J"erver"nter extends 2emote
+ pu*lic dou*le add(dou*le d1Edou*le d!) thro<s 2emoteException)
pu*lic dou*le su*(dou*le d1Edou*le d!) thro<s 2emoteException)
pu*lic dou*le mul(dou*le d1Edou*le d!) thro<s 2emoteException)
pu*lic dou*le div(dou*le d1Edou*le d!) thro<s 2emoteException)
>
RMI Serer I#*$e#e&tat%!& Pr!"ra#
import $ava.rmi.()
import $ava.rmi.server.()
pu*lic class 2J"erver"mpl extends .nicast2emote1*$ect
implements 2J"erver"nter
+
pu*lic 2J"erver"mpl() thro<s Exception
+
>pu*lic dou*le add(dou*le d1Edou*le d!) thro<s 2emoteException
+ return d1Ad!)
>
pu*lic dou*le su*(dou*le d1Edou*le d!) thro<s 2emoteException
24
+ return d1Gd!)
>
pu*lic dou*le mul(dou*le d1Edou*le d!) thro<s 2emoteException
+ return d1(d!)
>
pu*lic dou*le div(dou*le d1Edou*le d!) thro<s 2emoteException
+ return d1Od!)
> >
RMI Serer Pr!"ra#
import $ava.rmi.()
import $ava.net.()
pu*lic class 2J"erver
+ pu*lic static void main(tring args45)
+
try
+ 2J"erver"mpl ad3ne< 2J"erver"mpl())
?aming.re*ind(;2J"erver;Ead))
>
catch(Exception e)
+ ystem.out.println(;Error ... ; A e.getJessage()))
> > >
RMI C$%e&t Pr!"ra#:
import $ava.rmi.()
import $ava.net.()
pu*lic class 2J"Client
+ pu*lic static void main(tring args45)
+
try
+ tring serverurl3;rmi:OOlocalhostO2J"erver;)
2J"erver"nter ad3(2J"erver"nter) ?aming.loo#up(serverurl))
ystem.out.println(;The um of the values is : ;A ad.add('7E!7)))
ystem.out.println(;The Difference of the values is : ;Aad.su*(&7E!7)))
ystem.out.println(;The Product of the values is : ;A ad.mul(!'E!7)))
ystem.out.println(;The Divition of the values is : ;A ad.div(!77E!7)))
25
>
catch(Exception e)
+ ystem.out.println(;Error ... ; A e.getJessage())) > >
OUTPUT:
RMIServerInter.java :
javac RMIServerInter.java
RMIServerImpl.java :
javac RMIServerImpl.java
RMIServer.java :
javac RMIServer.java
RMIClient.java :
javac RMIClient.java
Start RMI Registry :
start rmiregistry
RMIServerImpl.class:
rmic RMIServerImpl
javac RMIClient.java
javac RMIServer.java
javac RMIServerImpl.java
javac RMIServerInter.java
26
RMIServer.java :
java RMIServer
RMIClient.java :
java RMIClient
The Sum of the values is : 70.0
The Difference of the values is : 0.0
The !ro"uct of the values is : #00.0
The Divition of the values is : $0.0
RESULT:
Thus the a*ove program for 2emote Procedure Calls <as executed and successfully.
27
Ex.no:'
Date :
SIMULATION OF SLIDING 'INDO' PROTOCOL
AIM:
To <rite a C program to perform sliding <indo<.
ALGORITHM:
1. tart the program.
!. Pet the frame siQe from the user
%. Create the frame *ased on the user reLuest.
&. end frames to server from the client side.
'. "f your frames reach the server it <ill send -CM signal to client other<ise it <ill
send ?-CM signal to client.
:. top the program
PROGRAM:
import $ava.io.()
class sliding
+
int pa#E<insiQeEp#no)
pu*lic sliding() thro<s Exception
+
Data"nputtream ds3ne< Data"nputtream(ystem.in))
ystem.out.println(;E?TE2 THE @"?D1@ "RE ;))
<insiQe3"nteger.parse"nt(ds.read/ine()))
ystem.out.println(;E?TE2 THE T1T-/ ?1 1, P-CMET ;))
pa#3"nteger.parse"nt(ds.read/ine()))
if(pa#8<insiQe)
+
ystem.out.println(;D1 S1. @-?T T1 M"// -?S P-CMETTT (SO?);))
tring #3ds.read/ine())
if(#.eLuals(;S;))
+
ystem.out.println(;E?TE2 P-CMET ?1 T1 M"// ;))
p#no3"nteger.parse"nt(ds.read/ine()))
>
>
>
pu*lic void selrepeat(int pn) thro<s Exception
+
ystem.out.println(;elective repeat of pac#et; A pn))
ystem.out.println(;Pac#et ; Apn A ;send;))
28
ystem.out.println(;Pac#et; A pn A ;2eceived;))
ystem.out.println(;-c#no<ledge; A pn A ;2eceived;))
>
pu*lic void trans() thro<s Exception
+
int dis37Edis137)
for(int i31) i83pa#))
+
for(int $31)$83<insiQe == i83pa#)$AAEiAA)
+
if(i33p#no)
+
dis31)
ystem.out.println(;Pac#et; A p#no A ;Discarded;))
ystem.out.println(;2emaining pac#et to *e sent in this seission is ; A (<insiQeG$)))
if($33<insiQe)
dis131)
Thread.sleep(!777))
>
else
+
ystem.out.println(;Pac#et; A i A ;send;))
ystem.out.println(;Pac#et; A i A ;2eceived;))
ystem.out.println(;-c#no<ledge; A i A ;2eceived;))
>
>
if(dis1331)
+
dis137)
continue)
>
if(dis331)
+
selrepeat(p#no))
dis37)
>
>
>
pu*lic static void main(tring args45) thro<s Exception
+
sliding s3 ne< sliding()) s.trans()) > >
29
OUTPUT:
RESULT:
Thus the a*ove program sliding <indo< protocol <as executed and successfully.
30
EX: NO: +a,
DATE:
IMPLEMENTATION OF ADDRESS RESOLUTION PROTOCOL
AIM:
To get the J-C or Physical address of the system using -ddress 2esolution Protocol.
ALGORITHM:
1. tart the program
!. "nclude the necessary pac#ages in $ava
%. Create a soc#et in client to server.
&. The client esta*lishes a connection to the server.
'. Pet the physical address from user ie.E "P address.
:. Then it <ill communicate to server and display the corresponding logical address
ie.E J-C address.
D. top the program.
PROGRAM:
C$%e&t:
import $ava.io.()
import $ava.net.()
import $ava.util.()
class Clientarp
+
pu*lic static void main(tring args45)
+
try
+
Fuffered2eader in3ne< Fuffered2eader(ne< "nputtream2eader(ystem.in)))
oc#et clsct3ne< oc#et(;1!D.7.7.1;E1%K))
Data"nputtream din3ne< Data"nputtream(clsct.get"nputtream()))
Data1utputtream dout3ne< Data1utputtream(clsct.get1utputtream()))
31
ystem.out.println(;Enter the /ogical address("P):;))
tring str13in.read/ine())
dout.<riteFytes(str1AUBnU))
tring str3din.read/ine())
ystem.out.println(;The Physical -ddress is: ;Astr))
clsct.close())
>
catch (Exception e)
+
ystem.out.println(e))
>
>
>
Serer:
import $ava.io.()
import $ava.net.()
import $ava.util.()
class erverarp
+
pu*lic static void main(tring args45)
+
try
+
erveroc#et o*$3ne< erveroc#et(1%K))
oc#et o*$13o*$.accept())
<hile(true)
+
Data"nputtream din3ne< Data"nputtream(o*$1.get"nputtream()))
Data1utputtream dout3ne<
Data1utputtream(o*$1.get1utputtream()))
tring str3din.read/ine())
tring ip453+;1:'.1:'.N7.N7;E;1:'.1:'.DK.1;>)
tring mac453+;:-:7N:--:C!;E;N-:FC:E%:,-;>)
for(int i37)i8ip.length)iAA)
+
if(str.eLuals(ip4i5))
32
+
dout.<riteFytes(mac4i5AUBnU))
*rea#)
>
>
o*$.close())
>

>
catch(Exception e)
+
ystem.out.println(e))
>
>>
OUTPUT:
E:Bnet<or#s6$ava erverarp
E:Bnet<or#s6$ava Clientarp
Enter the /ogical address("P):
1:'.1:'.N7.N7
The Physical -ddress is: :-:7N:--:C!
RESULT:
Thus the J-C address <as generated for "P address using -2P protocol.
33
EX:NO:+(-)
DATE:
IMPLEMENTATION OF REVERSE ADDRESS RESOLUTION PROTOCOL
AIM:
To <rite a program for reverse address resolution protocol (2-2P).
ALGORITHM:
1. tart the program
!. "nclude the necessary pac#ages in $ava
%. Create a soc#et in client to server.
&. The client esta*lishes a connection to the server.
'. Pet the logical address from user ie.E J-C address.
:. Then it <ill communicate to server and display the corresponding physical
address ie.E "P address.
D. top the program.
PROGRAM:
C$%e&t:
import $ava.io.()
import $ava.net.()
import $ava.util.()
class Clientrarp
+
pu*lic static void main(tring args45)
+
try
+
Fuffered2eader in3ne< Fuffered2eader(ne< "nputtream2eader(ystem.in)))
oc#et clsct3ne< oc#et(;1!D.7.7.1;E1%K))
Data"nputtream din3ne< Data"nputtream(clsct.get"nputtream()))
Data1utputtream dout3ne< Data1utputtream(clsct.get1utputtream()))
ystem.out.println(;Enter the Physical -ddres (J-C):;))
tring str13in.read/ine())
dout.<riteFytes(str1AUBnU))
tring str3din.read/ine())
34
ystem.out.println(;The /ogical address is("P):;Astr))
clsct.close())
>
catch (Exception e)
+
ystem.out.println(e))
>
>
>
Serer:
import $ava.io.()
import $ava.net.()
import $ava.util.()
class erverrarp
+
pu*lic static void main(tring args45)
+
try
+
erveroc#et o*$3ne< erveroc#et(1%K))
oc#et o*$13o*$.accept())
<hile(true)
+
Data"nputtream din3ne< Data"nputtream(o*$1.get"nputtream()))
Data1utputtream dout3ne<
Data1utputtream(o*$1.get1utputtream()))
tring str3din.read/ine())
tring ip453+;1:'.1:'.N7.N7;E;1:'.1:'.DK.1;>)
tring mac453+;:-:7N:--:C!;E;N-:FC:E%:,-;>)
for(int i37)i8mac.length)iAA)
+
if(str.eLuals(mac4i5))
+
dout.<riteFytes(ip4i5AUBnU))
*rea#)
>
>
o*$.close())
35
>

>
catch(Exception e)
+
ystem.out.println(e))
>
>
>
OUTPUT:
E:.&et/!r0123aa Sererrar*
E:.&et/!r0123aa C$%e&trar*
E&ter the Ph41%)a$ A55re11 (MAC):
+A:67:AA:C8
The %1 L!"%)a$ a55re11(IP): 9+:,9+:,76,76
RESULT:
Thus the program for reverse address resolution protocol (2-2P) is executed successfully.
36
Ex.no:D
Date :
IMPLEMENTATION OF ROUTING PROTOCOL - ;GP
AIM:
To simulate the "mplementing 2outing Protocols using Forder Pate<ay Protocol (FPP)
ALGORITHM:
1. 2ead the no. of nodes n
!. 2ead the cost matrix for the path from each node to another node.
%. "nitialiQe 1.2CE to 1 and include 1
&. Compute D of a node <hich is the distance from source to that corresponding node.
'. 2epeat step : to step N for nGl nodes.
:. Choose the node that has not *een included <hose distance is minimum and include that node.
D. ,or every other node not included compare the distance directly from the source <ith the distance to
reach the node using the ne<ly included node
N. Ta#e the minimum value as the ne< distance.
K. Print all the nodes <ith shortest path cost from source node
PROGRAM :
Vinclude 8stdio.h6
Vinclude8conio.h6
int main()
+ int n)
int iE$E#)
int a41754175E*41754175)
printf(;Bn Enter the num*er of nodes:;))
scanf(;Wd;E=n))
for(i37)i8n)iAA)
+
for($37)$8n)$AA)
+
printf(;Bn Enter the distance *et<een the host Wd G Wd:;EiA1E$A1))
scanf(;Wd;E=a4i54$5))
>>
f or(i37)i8n)iAA)
+
f or($37)$8n)$AA)
+
printf(;WdBt;Ea4i54$5))
>
printf(;Bn;))
>
for(#37)#8n)#AA)
37
+
for(i37)i8n)iAA)
+
for($37)$8n)$AA)
+
if(a4i54$56a4i54#5Aa4#54$5)
+
a4i54$53a4i54#5Aa4#54$5)
>>>>
for(i37)i8n)iAA)
+
for($37)$8n)$AA)
+
*4i54$53a4i54$5)
if(i33$)
+
*4i54$537)
> >>
printf(;Bn The output matrix:Bn;))
for(i37)i8n)iAA)
+
for($37)$8n)$AA)
+
printf(;WdBt;E*4i54$5))
>
printf(;Bn;))
>
getch())
>
38
OUTPUT:
E&ter the &<#-er !( &!5e1:=
E&ter the 5%1ta&)e -et/ee& the h!1t 9 - 9::
E&ter the 5%1ta&)e -et/ee& the h!1t 9 - 8:>
E&ter the 5%1ta&)e -et/ee& the h!1t 9 - ?:+
E&ter the 5%1ta&)e -et/ee& the h!1t 9 - =:=
E&ter the 5%1ta&)e -et/ee& the h!1t 8 - 9:8
E&ter the 5%1ta&)e -et/ee& the h!1t 8 - 8:9
E&ter the 5%1ta&)e -et/ee& the h!1t 8 - ?:7
E&ter the 5%1ta&)e -et/ee& the h!1t 8 - =:?
E&ter the 5%1ta&)e -et/ee& the h!1t ? - 9:+
E&ter the 5%1ta&)e -et/ee& the h!1t ? - 8:9
E&ter the 5%1ta&)e -et/ee& the h!1t ? - ?:=
E&ter the 5%1ta&)e -et/ee& the h!1t ? - =:8
E&ter the 5%1ta&)e -et/ee& the h!1t = - 9::
E&ter the 5%1ta&)e -et/ee& the h!1t = - 8:9
E&ter the 5%1ta&)e -et/ee& the h!1t = - ?:7
E&ter the 5%1ta&)e -et/ee& the h!1t = - =:8
: > + =
8 9 7 ?
+ 9 = 8
: 9 7 8
The !<t*<t #atr%@:
6 : + =
8 6 7 ?
? 9 6 8
? 9 7 6
RESULT:
Thus the a*ove program to simulate the "mplementing 2outing Protocols using *order
Pate<ay protocol <as executed and successfully.
39
EX NO:7
Date :
IMPLEMENTATION OF OPEN SHORTEST PATH FIRSTROUTING PROTOCOL
AIM:
To simulate the 1PE? H12TET P-TH ,"2T routing protocol *ased on the cost assigned to
the path.
ALGORITHM:
1. 2ead the no. of nodes n
!. 2ead the cost matrix for the path from each node to another node.
%. "nitialiQe 1.2CE to 1 and include 1
&. Compute D of a node <hich is the distance from source to that corresponding node.
'. 2epeat step : to step N for nGl nodes.
:. Choose the node that has not *een included <hose distance is minimum and
include that node.
D. ,or every other node not included compare the distance directly from the source <ith
the distance to reach the node using the ne<ly included node
N. Ta#e the minimum value as the ne< distance.
K. Print all the nodes <ith shortest path cost from source node
PROGRAM:
Vinclude8stdio.h6
Vinclude8conio.h6
int a4'54'5EnEiE$)
void main()
+
void getdata())
void shortest())
void display())
clrscr())
printf(;BnBn P21P2-J T1 ,"?D H12TET P-TH FET@EE? T@1 ?1DEBn;))
40
getdata())
shortest())
display())
getch())
>
void getdata()
+
clrscr())
printf(;BnBnE?TE2 THE ?.JFE2 1, H1T "? THE P2-PHBn;))
scanf(;Wd;E=n))
printf(;BnBn", THE2E " ?1 D"2ECT P-TH Bn;))
printf(; BnBn-"P? THE H"PHET D"T-?CE X-/.E 1777 Bn;))
for(i37)i8n)iAA)
+
a4i54$537)
for($37)$8n)$AA)
+
if(iC3$)
+
printf(;BnBnE?TE2 THE D"T-?CE FET@E?? (WdEWd): ;EiA1E$A1))
scanf(;Wd;E=a4i54$5))
if(a4i54$5337)
a4i54$531777)
>
>
>
>
void shortest()
+
int iE$E#)
for(#37)#8n)#AA)
for(i37)i8n)iAA)
for($37)$8n)$AA)
+
if(a4i54#5Aa4#54$58a4i54$5)
a4i54$53a4i54#5Aa4#54$5)
>
>
void display()
+
int iE$)
for(i37)i8n)iAA)
for($37)$8n)$AA)
if(iC3$)
41
+
printf(;Bn H12TET P-TH " : (WdEWd)GGWdBn;EiA1E$A1Ea4i54$5))
>
getch()) >
O<t*<t:
E&ter the D%1ta&)e ;et/ee& (8A9): 8
E&ter the D%1ta&)e ;et/ee& (8A?): ?
E&ter the D%1ta&)e ;et/ee& (8A=): 9
E&ter the D%1ta&)e ;et/ee& (?A9): ?
E&ter the D%1ta&)e ;et/ee& (?A8): ?
E&ter the D%1ta&)e ;et/ee& (?A=): 8
E&ter the D%1ta&)e ;et/ee& (=A9): 9
E&ter the D%1ta&)e ;et/ee& (=A8): 9
E&ter the D%1ta&)e ;et/ee& (=A?): 8
Sh!rte1t *ath %1: (9A8)--8
Sh!rte1t *ath %1: (9A?)--?
Sh!rte1t *ath %1: (9A=)--9
Sh!rte1t *ath %1: (8A9)--8
Sh!rte1t *ath %1: (8A?)--?
Sh!rte1t *ath %1: (8A=)--9
Sh!rte1t *ath %1: (?A9)--?
Sh!rte1t *ath %1: (?A8)--?
Sh!rte1t *ath %1: (?A=)--8
Sh!rte1t *ath %1: (=A9)--9
Sh!rte1t *ath %1: (=A8)--9
Sh!rte1t *ath %1: (=A?)--8
RESULT:

Thus the a*ove program to simulate the "mplementing 2outing Protocols using open shortest path first
(1P,) <as executed and successfully
42
Ex.no:K
Date :
STUDB OF UDP PERFORMANCE
I&tr!5<)t%!&
Jost net<or# games use the .ser Datagram Protocol (.DP) as the underlying transport protocol.
The Transport Control Protocol (TCP)E <hich is <hat most "nternet traffic relies onE is a relia*le
connectionGoriented protocol that allo<s datastreams coming from a machine connected to the "nternet to
*e received <ithout error *y any other machine on the "nternet. .DP ho<everE is an unrelia*le
connectionless protocol that does not guarantee accurate or unduplicated delivery of data.
'h4 5! "a#e1 <1e UDPC
TCP has proved too complex and too slo< to sustain realGtime gameGplay. .DP allo<s gaming
application programs to send messages to other programs <ith the minimum of protocol mechanism.
Pames do not rely upon ordered relia*le delivery of data streams. @hat is more important to gaming
applications is the prompt delivery of data. .DP allo<s applications to send "P datagrams to other
applications <ithout having to esta*lish a connection and than having to release it laterE <hich increases
the speed of communication. .DP is descri*ed in 2,C D:N. The .DP segment sho<n a*ove consists of
an NG*yte header follo<ed *y the data octets.
F%e$51
The source and destination ports identify the end points <ithin the source and Destination
machines. The source port indicates the port of the sending process and unless other<ise stated it is the
port to <hich a reply should *e sent to. - Qero is inserted into it if it is not used. The .DP /ength field
sho<s the length of the datagram in octets. "t includes the NG*yte header and the data to *e sent.
The .DP chec#sum field contains the .DP headerE .DP data and the pseudo header sho<n
a*ove. The pseudoGheader contains the %!G*it "P addresses of the source and destination machinesE the
.DP protocol num*er and the *yte count for the .DP segment. The pseudoGheader helps to find
undelivered pac#ets or pac#ets that arrive at the <rong address. Ho<ever the pseudoGheader violates the
protocol hierarchy *ecause the "P addresses <hich are used in it *elong to the "P layer and not to the .DP
layer.
UDP Late&)4
@hile TCP implements a form of flo< control to stop the net<or# from flooding there is no such
concept in .DP. This is *ecause .DP does not rely on ac#no<ledgements to signal successful delivery of
data. Pac#ets are simply transmitted one after another <ith complete disregard to event of the receiver
*eing flooded.
The e((e)t1 !( UDP
-s mentioned *efore the ma$ority of the traffic on the "nternet relies on TCP. @ith the explosive
increase in the amount of gaming ta#ing place on the "nternetE and <ith most of these games using
.DPE there are concerns a*out the effects that .DP <ill have on TCP traffic.
- study carried out in the .niversity of @ai#ato in ?e< Realand suggests that .DP traffic has a
negative effect on TCP throughput. .DP is no< seen as *eing aggressive to 'network friendly
applications deploying adaptive congestion control'.
43
Y@hile TCP implements a form of flo< control to stop the net<or# from flooding there is no such
concept in .DP. This is *ecause .DP does not rely on ac#no<ledgements to signal successful delivery of
data. Pac#ets are simply transmitted one after another <ith complete disregard to event of the receiver
*eing flooded. .DP affects TCP throughput in much the same <ay as digitiQed speech over "P does. The
study sho<s that .DP *ehaves in much the same <ay regardless of <hat application is running it.
UDP ;r!a5)a1t F$!!5%&"
- broadcast is a data pac#et that is destined for multiple hosts. Froadcasts can occur at the data
lin# layer and the net<or# layer. DataGlin# *roadcasts are sent to all hosts attached to a particular physical
net<or#. ?et<or# layer *roadcasts are sent to all hosts attached to a particular logical net<or#. The
Transmission Control ProtocolO"nternet Protocol (TCPO"P) supports the follo<ing types of *roadcast
pac#ets:
Z All ones[Fy setting the *roadcast address to all ones (!''.!''.!''.!'')E all hosts on
the net<or# receive the *roadcast.
Z Network[Fy setting the *roadcast address to a specific net<or# num*er in the ?et<or# portion of the
"P address and setting all ones in the host portion of the *roadcast addressE all hosts on the specified
net<or# receive the *roadcast. ,or exampleE <hen a *roadcast pac#et is sent <ith the *roadcast address of
1%1.17N.!''.!''E all hosts on net<or# num*er 1%1.17N receive the *roadcast.
Z Subnet[Fy setting the *roadcast address to a specific net<or# num*er and a specific su*net num*erE all
hosts on the specified su*net receive the *roadcast. ,or exampleE <hen a *roadcast pac#et is set <ith the
*roadcast address of 1%1.17N.&.!''E all hosts on su*net & of net<or# 1%1.17N receive the *roadcast.
Fecause *roadcasts are recogniQed *y all hostsE a significant goal of router configuration is to control
unnecessary proliferation of *roadcast pac#ets. Cisco routers support t<o #inds of *roadcasts: directed
and flooded.
- directed *roadcast is a pac#et sent to a specific net<or# or series of net<or#sE <hereas a
flooded *roadcast is a pac#et sent to every net<or#. "n "P internet<or#sE most *roadcasts ta#e the form of
.ser Datagram Protocol (.DP) *roadcasts. -lthough current "P implementations use a *roadcast address
of all onesE the first "P implementations used a *roadcast address of all Qeros. Jany of the early
implementations do not recogniQe *roadcast addresses of all ones and fail to respond to the *roadcast
correctly. 1ther early implementations for<ard *roadcasts of all onesE <hich causes a serious net<or#
overload #no<n as a broadcast storm. "mplementations that exhi*it these pro*lems include systems *ased
on versions of FD .?"I prior to Xersion &.%. "n the *ro#erage communityE applications use .DP
*roadcasts to transport mar#et data to the des#tops of traders on the trading floor. This case study gives
examples of ho< *ro#erages have implemented *oth directed and flooding *roadcast schemes in an
environment that consists of Cisco routers and un <or#stations.. ?ote that the addresses in this net<or#
use a 17G*it netmas# of !''.!''.!''.1K!.
"nternet<or#ing Case tudies
.DP *roadcasts must *e for<arded from a source segment (,eed net<or#) to many destination
segments that are connected redundantly. ,inancial mar#et dataE providedE for exampleE *y 2eutersE enters
the net<or# through the un <or#stations connected to the ,eed net<or# and is disseminated to the T"C
servers. The T"C servers are un <or#stations running Te#ne#ron "nformation Cluster soft<are. The un
<or#stations on the trader net<or#s su*scri*e to the T"C servers for the delivery of certain mar#et dataE
<hich the T"C servers deliver *y means of .DP *roadcasts. The t<o routers in this net<or# provide
redundancy so that if one router *ecomes unavaila*leE the other router can assume the load of the failed
router <ithout intervention from an operator. The connection *et<een each router and the ,eed net<or# is
for net<or# administration purposes only and does not carry user traffic. T<o different approaches can *e
44
used to configure Cisco routers for for<arding .DP *roadcast traffic: "P helper addressing and .DP
flooding. This case study analyQes the advantages and disadvantages of each approach.
2outer - 2outer F
1:&.'%.N.7 1:&.'%.K.7 1:&.'%.17.7
E1
E7 E7
E1
T"C server net<or# 1:&.'%.D.7
!77.!77.!77.7
,eed ?et<or#
!77.!77.!77.:1 !77.!77.!77.:!
1:&.'%.D.:1 1:&.'%.D.:!
1:&.'%.N.:1
1:&.'%.K.:1
1:&.'%.17.:1
Trader ?et 1 Trader ?et ! Trader ?et %
T"C T"C T"C T"C
1:&.'%.K.:!
1:&.'%.17.:!
E& 1:&.'%.N.:!
E! E%
E&
E! E%
.DP Froadcast ,looding
I#*$e#e&t%&" IP He$*er A55re11%&"
N!te 2egardless of <hether you implement "P helper addressing or .DP floodingE you
must use the %* (!r/ar5-*r!t!)!$ <5* glo*al configuration command to ena*le the
.DP for<arding. Fy defaultE the %* (!r/ar5-*r!t!)!$ <5* command ena*les for<arding for ports
associated <ith the follo<ing protocols: Trivial ,ile Transfer ProtocolE Domain
?ame ystemE Time serviceE ?etF"1 ?ame erverE ?etF"1 Datagram erverE Foot
ProtocolE and Terminal -ccess Controller -ccess Control ystem. To ena*le for<arding
for other portsE you must specify them as arguments to the %* (!r/ar5-*r!t!)!$ <5*
command.
I#*$e#e&t%&" IP He$*er A55re11%&"
"P helper addressing is a form of static addressing that uses directed *roadcasts to for<ard local
and allGnets *roadcasts to desired destinations <ithin the internet<or#.
To configure helper addressingE you must specify the %* he$*er-a55re11 command on
every interface on every router that receives a *roadcast that needs to *e for<arded.
1n 2outer - and 2outer FE "P helper addresses can *e configured to move data from the T"C server
net<or# to the trader net<or#s. "P helper addressing in not the optimal solution for this type of topology
*ecause each router receives unnecessary *roadcasts from the other router.
45
I#*$e#e&t%&" IP He$*er A55re11%&"
"n this caseE 2outer - receives each *roadcast sent *y 2outer F three timesE one for each segmentE
and 2outer F receives each *roadcast sent *y 2outer - three timesE one for each segment. @hen each
*roadcast is receivedE the router must analyQe it and
Determine that the *roadcast does not need to *e for<arded. -s more segments are added to the net<or#E
the routers *ecome overloaded <ith unnecessary trafficE <hich must *e analyQed and discarded.
@hen "P helper addressing is used in this type of topologyE no more than one router can *e
configured to for<ard .DP *roadcasts (unless the receiving applications can handle duplicate
*roadcasts). This is *ecause duplicate pac#ets arrive on the trader net<or#. This restriction limits
redundancy in the design and can *e undesira*le in some implementations.
To send .DP *roadcasts *idirectionally in this type of topologyE a second %* he$*er a55re11
command must *e applied to every router interface that receives .DP *roadcasts. -s more segments and
devices are added to the net<or#E more %* he$*er a55re11 commands are reLuired to reach themE so the
administration of these routers *ecomes more complex over time. ?oteE tooE that *idirectional traffic in
this topology significantly impacts router performance.
2outer - 2outer F
1:&.'%.N.7 1:&.'%.K.7 1:&.'%.17.7
E1
E7 E7
E1
T"C server net<or# 1:&.'%.D.7
!77.!77.!77.7
,eed ?et<or#
!77.!77.!77.:1 !77.!77.!77.:!
1:&.'%.D.:1 1:&.'%.D.:!
1:&.'%.N.:1
1:&.'%.K.:1
1:&.'%.17.:1
Trader ?et 1 Trader ?et ! Trader ?et %
T"C T"C T"C T"C
1:&.'%.K.:!
1:&.'%.17.:!
E& 1:&.'%.N.:!
E! E%
E&
E! E%
.DP pac#ets
.DP Froadcast ,looding
I#*$e#e&t%&" UDP F$!!5%&"
-lthough "P helper addressing is <ellGsuited to nonredundantE nonparallel topologies
That do not reLuire a mechanism for controlling *roadcast loopsE in vie< of these dra<*ac#sE "P helper
addressing does not <or# <ell in this topology. To improve performanceE net<or# designers considered
several other alternatives:
Z Setting the broadcast address on the TIC servers to all ones (!!"!!"!!"!!#[This
alternative <as dismissed *ecause the T"C servers have more than one interfaceE
46
causing T"C *roadcasts to *e sent *ac# onto the ,eed net<or#. "n additionE some <or#station
implementations do not allo< all ones *roadcasts <hen multiple interfaces are present.
Z Setting the broadcast address of the TIC servers to the ma$or net broadcast (%&'"!(")")#[This
alternative <as dismissed *ecause the un TCPO"P implementation
does not allo< the use of ma$or net *roadcast addresses <hen the net<or# is
su*netted.
Z *liminating the subnets and letting the workstations use Address +esolution ,rotocol
(A+,# to learn addresses[This alternative <as dismissed *ecause the T"C servers
cannot Luic#ly learn an alternative route in the event of a primary router failure. @ith alternatives
eliminatedE the net<or# designers turned to a simpler implementation that supports redundancy <ithout
duplicating pac#ets and that ensures fast convergence
and minimal loss of data <hen a router fails: .DP flooding.
I#*$e#e&t%&" UDP F$!!5%&"
N!te This topology is *roadcast intensive[*roadcasts sometimes consume !7 percent 1f the Ethernet
*and<idth. Ho<everE this is a favora*le percentage <hen compared to the configuration of "P helper
addressingE <hichE in the same net<or#E causes *roadcasts to consume up to '7 percent of the Ethernet
*and<idth. "f the hosts on the trader net<or#s do not support "2DPE the Hot tand*y 2outing Protocol
(H2P) can *e used to select <hich router <ill handle unicast traffic. H2P allo<s the stand*y router to
ta#e over Luic#ly if the primary router *ecomes unavaila*le. ,or information a*out configuring H2PE
the follo<ing command: ip for<ardGprotocol tur*oGflood
2outer - 2outer F
1:&.'%.N.7 1:&.'%.K.7 1:&.'%.17.7
E1
E7 E7
E1
T"C server net<or# 1:&.'%.D.7
!77.!77.!77.7
,eed ?et<or#
!77.!77.!77.:1 !77.!77.!77.:!
1:&.'%.D.:1 1:&.'%.D.:!
1:&.'%.N.:1
1:&.'%.K.:1
1:&.'%.17.:1
Trader ?et 1 Trader ?et ! Trader ?et %
T"C T"C T"C T"C
1:&.'%.K.:!
1:&.'%.17.:!
E& 1:&.'%.N.:!
E! E%
E&
E! E%
.nicast pac#ets
.DP pac#ets
47
I#*$e#e&t%&" UDP F$!!5%&"
"nternet<or#ing Case tudies
N!te Tur*o flooding increases the amount of processing that is done at interrupt levelE <hich increases
the CP. load on the router. Tur*o flooding may not *e appropriate on routers that are already under high
CP. load or that must also perform other CP.intensive activities.
The follo<ing commands configure .DP flooding on 2outer -. Fecause this configuration does not
specify a lo<er path cost than the default and *ecause the configuration of 2outer F specifies a lo<er cost
than the default <ith regard to .DP floodingE 2outer - acts as a *ac#up to 2outer F. Fecause this
configuration specifies an "2DP preference of 177 and *ecause 2outer F specifies a "2DP preference of
K7 (%* %r5* *re(ere&)e >6)E 2outer - for<ards unicast traffic from the trader net<or#sE and 2outer F is
the *ac#up for unicast traffic for<arding.
C2outer -:
ip for<ardGprotocol spanningGtree
ip for<ardGprotocol udp 111
ip for<ardGprotocol udp %771
ip for<ardGprotocol udp %77!
ip for<ardGprotocol udp %77%
ip for<ardGprotocol udp %77&
ip for<ardGprotocol udp %77'
ip for<ardGprotocol udp %77:
ip for<ardGprotocol udp '7!7
ip for<ardGprotocol udp '7!1
ip for<ardGprotocol udp '7%7
ip for<ardGprotocol udp '77!
ip for<ardGprotocol udp 17!D
ip for<ardGprotocol udp :'D
C interface ethernet 7
ip address !77.!77.!77.:1 !''.!''.!''.7
ip *roadcastGaddress !77.!77.!77.!''
no mop ena*led
C interface ethernet 1
ip address 1:&.'%.D.:1 !''.!''.!''.1K!
ip *roadcastGaddress 1:&.'%.D.:%
ip irdp
ip irdp maxadvertinterval :7
ip irdp minadvertinterval &'
ip irdp holdtime :7
ip irdp preference 177
*ridgeGgroup 1
*ridgeGgroup 1 inputGtypeGlist !71
no mop ena*led
C interface ethernet !
ip address 1:&.'%.N.:1 !''.!''.!''.1K!
ip *roadcastGaddress 1:&.'%.N.:%
ip irdp
ip irdp maxadvertinterval :7
48
ip irdp minadvertinterval &'
ip irdp holdtime :7
ip irdp preference 177
*ridgeGgroup 1
*ridgeGgroup 1 inputGtypeGlist !71
no mop ena*led
C interface ethernet %
ip address 1:&.'%.K.:1 !''.!''.!''.1K!
ip *roadcastGaddress 1:&.'%.K.:%
ip irdp
ip irdp maxadvertinterval :7
.DP Froadcast ,looding +->
I#*$e#e&t%&" UDP F$!!5%&"
ip irdp minadvertinterval &'
ip irdp holdtime :7
ip irdp preference 177
*ridgeGgroup 1
*ridgeGgroup 1 inputGtypeGlist !71
no mop ena*led
C interface ethernet &
ip address 1:&.'%.17.:1 !''.!''.!''.1K!
ip *roadcastGaddress 1:&.'%.17.:%
ip irdp
ip irdp maxadvertinterval :7
ip irdp minadvertinterval &'
ip irdp holdtime :7
ip irdp preference 177
*ridgeGgroup 1
*ridgeGgroup 1 inputGtypeGlist !71
no mop ena*led
C
router igrp 1
net<or# 1:&.'%.7.7
C ip nameGserver !''.!''.!''.!''
snmpGserver community pu*lic 2@
snmpGserver host 1:&.'%.D.1' pu*lic
*ridge 1 protocol dec
*ridge 1 priority !''
accessGlist !71 deny 7x,,,, 7x7777
The follo<ing commands configure .DP flooding on 2outer F. Fecause this configuration
specifies a lo<er path cost than the default (-r%5"e-"r!<* 9 *ath-)!1t :6) and *ecause the configuration
of 2outer - accepts the defaultE 2outer F for<ards .DP pac#ets. Fecause this configuration specifies an
"2DP preference of K7 (%* %r5* *re(ere&)e >6) and *ecause 2outer - specifies a "2DP preference of 177E
2outer F acts as the *ac#up for 2outer - for for<arding unicast traffic from the trader net<or#s. C2outer
F ip for<ardGprotocol spanningGtree
ip for<ardGprotocol udp 111
ip for<ardGprotocol udp %771
ip for<ardGprotocol udp %77!
ip for<ardGprotocol udp %77%
ip for<ardGprotocol udp %77&
49
ip for<ardGprotocol udp %77'
ip for<ardGprotocol udp %77:
ip for<ardGprotocol udp '7!7
ip for<ardGprotocol udp '7!1
ip for<ardGprotocol udp '7%7
ip for<ardGprotocol udp '77!
ip for<ardGprotocol udp 17!D
ip for<ardGprotocol udp :'D
C interface ethernet 7
ip address !77.!77.!77.:! !''.!''.!''.7
ip *roadcastGaddress !77.!77.!77.!''
no mop ena*led
C interface ethernet 1
ip address 1:&.'%.D.:! !''.!''.!''.1K!
ip *roadcastGaddress 1:&.'%.D.:%
ip irdp
ip irdp maxadvertinterval :7
ip irdp minadvertinterval &'
ip irdp holdtime :7
I#*$e#e&t%&" UDP F$!!5%&"
+-96 "nternet<or#ing Case tudies
ip irdp preference K7
*ridgeGgroup 1
*ridgeGgroup 1 pathGcost '7
*ridgeGgroup 1 inputGtypeGlist !71
no mop ena*led
C interface ethernet !
ip address 1:&.'%.N.:! !''.!''.!''.1K!
ip *roadcastGaddress 1:&.'%.N.:%
ip irdp
ip irdp maxadvertinterval :7
ip irdp minadvertinterval &'
ip irdp holdtime :7
ip irdp preference K7
*ridgeGgroup 1
*ridgeGgroup 1 pathGcost '7
*ridgeGgroup 1 inputGtypeGlist !71
no mop ena*led
C interface ethernet %
ip address 1:&.'%.K.:! !''.!''.!''.1K!
ip *roadcastGaddress 1:&.'%.K.:%
ip irdp
ip irdp maxadvertinterval :7
ip irdp minadvertinterval &'
ip irdp holdtime :7
ip irdp preference K7
*ridgeGgroup 1 *ridgeGgroup 1 pathGcost '7
*ridgeGgroup 1 inputGtypeGlist !71
no mop ena*led
C interface ethernet &
ip address 1:&.'%.17.:! !''.!''.!''.1K!
50
ip *roadcastGaddress 1:&.'%.17.:%
ip irdp
ip irdp maxadvertinterval :7
ip irdp minadvertinterval &'
ip irdp holdtime :7
ip irdp preference K7
*ridgeGgroup 1
*ridgeGgroup 1 pathGcost '7
*ridgeGgroup 1 inputGtypeGlist !71
no mop ena*led
C
router igrp 1
net<or# 1:&.'%.7.7
C ip nameGserver !''.!''.!''.!''
snmpGserver community pu*lic 2@
snmpGserver host 1:&.'%.D.1' pu*lic
*ridge 1 protocol dec
*ridge 1 priority !''
accessGlist !71 deny 7x,,,, 7x7777
C!&)$<1%!& :
Thus a tudy has *een performed a*out the performance of .DP.
51
Ex.no:17
Date :
STUDB OF TCP PERFORMANCE
I&tr!5<)t%!& :
The Transmission Control ,rotocol (TCP) and the .ser Datagram Protocol (.DP) are *oth "P
transportGlayer protocols. .DP is a light<eight protocol that allo<s applications to ma#e direct use of the
unrelia*le datagram service provided *y the underlying "P service. .DP is commonly used to support
applications that use simple LueryOresponse transactionsE or applications that support realGtime
communications. TCP provides a relia*le dataGtransfer serviceE and is used for *oth *ul# data transfer and
interactive data applications. TCP is the ma$or transport protocol in use in most "P net<or#sE and upports
the transfer of over K7 percent of all traffic across the pu*lic "nternet today. Piven this ma$or role for TCPE
the performance of this protocol forms a significant part of the total picture of service performance for "P
net<or#s. "n this article <e examine TCP in further detailE loo#ing at <hat ma#es a TCP session perform
relia*ly and <ell. This article dra<s on material pu*lished in the Internet ,erformance Survival -uide
415.
Oer%e/ !( TCP
TCP is the em*odiment of relia*le endGtoGend transmission functionality in the overall "nternet
architecture. -ll the functionality reLuired to ta#e a simple *ase of "P datagram delivery and *uild upon
this a control model that implements relia*ilityE seLuencingE flo< controlE and data streaming is em*edded
<ithin TCP 4!5. TCP provides a communication channel *et<een processes on each host system. The
channel is relia*leE fullGduplexE and streaming. To achieve this functionalityE the TCP drivers *rea# up the
session data stream into discrete segmentsE and attach a TCP header to each segment. -n "P header is
attached to this TCP pac#etE and the composite pac#et is then passed to the net<or# for delivery. This
TCP header has numerous fields that are used to support the intended TCP functionality. TCP has the
follo<ing functional characteristics: \ .nicast protocol : TCP is *ased on a unicast net<or# modelE and
supports data exchange *et<een precisely t<o parties. "t does not support *roadcast or multicast net<or#
models.
Connection state : 2ather than impose a state <ithin the net<or# to support the connectionE TCP uses
synchroniQed state *et<een the t<o endpoints. This synchroniQed state is set up as part of an initial
connection processE so TCP can *e regarded as a connectionGoriented protocol. Juch of the protocol
design is intended to ensure that each local state transition is communicated toE and ac#no<ledged *yE the
remote party.
Reliable : 2elia*ility implies that the stream of octets passed to the TCP driver at one end of the
connection <ill *e transmitted across the net<or# so that the stream is presented to the remote process as
the same seLuence of octetsE in the same order as that generated *y the sender. This implies that the
protocol detects <hen segments of the data stream have *een discarded *y the net<or#E reorderedE
duplicatedE or corrupted. @here necessaryE the sender <ill retransmit damaged segments so as to allo< the
receiver to reconstruct the original data stream. This implies that a TCP sender must maintain a local copy
of all transmitted data until it receives an indication that the receiver has completed an accurate transfer of
the data.
DFull duplex : TCP is a fullGduplex protocol) it allo<s *oth parties to send and receive data <ithin the
context of the single TCP connection.
52
DStreaming : -lthough TCP uses a pac#et structure for net<or# transmissionE TCP is a true streaming
protocolE and applicationGlevel net<or# operations are not transparent. ome protocols explicitly
encapsulate each application transaction) for every write E there must *e a matching read . "n this mannerE
the application derived segmentation of the data stream into a logical record structure is preserved across
the net<or#. TCP does not preserve such an implicit structure imposed on the data streamE so that there is
no pairing *et<een write and read operations <ithin the net<or# protocol. ,or exampleE a TCP
application may write three data *loc#s in seLuence into the net<or# connectionE <hich may *e collected
*y the remote reader in a single read operation. The siQe of the data *loc#s (segments) used in a TCP
session is negotiated at the start of the session. The sender attempts to use the largest segment siQe it can
for the data transferE <ithin the constraints of the maximum segment siQe of the receiverE the maximum
segment siQe of the configured senderE and the maxiGmum supporta*le non fragmented pac#et siQe of the
net<or# path (path /a0imum Transmission .nit 4JT.5). The path JT. is refreshed periodically to
ad$ust to any changes that may occur <ithin the net<or# <hile the TCP connection is active.
DRate adaptation : TCP is also a rateGadaptive protocolE in that the rate of data transfer is intended to adapt
to the prevailing load conditions <ithin the net<or# and adapt to the processing capacity of the receiver.
There is no predetermined TCP dataGtransfer rate) if the net<or# and the receiver *oth have additional
availa*le capacityE a TCP sender <ill attempt to in$ect more data into the net<or# to ta#e up this availa*le
space. ConverselyE if there is congestionE a TCP sender <ill reduce its sending rate to allo< the net<or# to
recover. This adaptation function attempts to achieve the highest possi*le dataGtransfer rate <ithout
triggering consistent data loss.
The TCP Pr!t!)!$ Hea5er
The TCP header structureE sho<n in ,igure 1E uses a pair of 1:G*it source and destination Port
addresses. The next field is a %!G*it seLuence num*erE <hich identifies the seLuence num*er of the first
data octet in this pac#et. The seLuence num*er does not start at an initial value of 1 for each ne< TCP
connection) the selection of an initial value is criticalE *ecause the initial value is intended to prevent
delayed data from an old connection from *eing incorrectly interpreted as *eing valid <ithin a current
connection. The seLuence num*er is necessary to ensure that arriving pac#ets can *e ordered in the
senderTs original order. This field is also used <ithin the flo<Gcontrol structure to allo< the association of
a data pac#et <ith its corresponding ac#no<ledgementE allo<ing a sender to estimate the current roundG
trip time across the net<or#.
The acknowledgment se1uence number is used to inform the remote end of the data that has *een
successfully received. The ac#no<ledgment seLuence num*er is actually one greater than that of the last
octet correctly received at the local end of the connection. The data offset field indicates the num*er of
fourGoctet <ords <ithin the TCP header. ix single bit flags are used to indicate various conditions. .2P
is used to indicate <hether the urgent pointer is valid. -CM is used to indicate <hether the
acknowledgment field is valid. PH is set <hen the sender <ants the remote application to push this data
to the remote application. 2T is used to reset the connection. S? (for synchroni2e ) is used <ithin the
connection startup phaseE and ,"? (for finish ) is used to close the connection in an orderly fashion. The
window field is a 1:G*it count of availa*le *uffer space. "t is added to the ac#no<ledgment seLuence
num*er to indicate the highest seLuence num*er the receiver can accept. The TCP checksum is applied to
a synthesiQed header that includes the source and destination addresses from the outer "P datagram. The
final field in the TCP header is the urgent pointerE <hichE <hen added to the seLuence num*erE indicates
the seLuence num*er of the final octet of urgent data if the urgent flag is set. Jany options can *e carried
in a TCP header. Those relevant to TCP performance include:
DMaximum-receive-segment-size option : This option is used <hen the connection is *eing opened. "t is
intended to inform the remote end of the maximum segment siQeE measured in octetsE that the sender is
<illing to receive on the TCP connection. This option is used only in the initial S? pac#et (the initial
53
pac#et exchange that opens a TCP connection). "t sets *oth the maximum receive segment siQe and the
maximum siQe of the advertised TCP <indo<E passed to the remote end of the connection. "n a ro*ust
implementation of TCPE this option should *e used <ith path JT. discovery to esta*lish a segment siQe
that can *e passed across the connection <ithout fragmentationE an essential attri*ute of a highG
performance data flo<.
DWindow-scale option : This option is intended to address the issue of the maximum <indo< siQe in the
face of paths that exhi*it a highGdelay *and<idth product. This option allo<s the <indo< siQe
advertisement to *e rightGshifted *y the amount specified (in *inary arithmeticE a rightGshift corresponds
to a multiplication *y !). @ithout this optionE the maximum <indo< siQe that can *e advertised is :'E'%'
*ytes (the maximum value o*taina*le in a 1:G*it field). The limit of TCP transfer speed is effectively one
<indo< siQe in transit *et<een the sender and the receiver. ,or highGspeedE longGdelay net<or#sE this
performance limitation is a significant factorE *ecause it limits the transfer rate to at most :'E'%' *ytes per
roundGtrip intervalE regardless of availa*le net<or# capacity. .se of the <indo<Gscale option allo<s the
TCP sender to effectively adapt to high*and<idthE highGdelay net<or# pathsE *y allo<ing more data to *e
held in flight. The maximum <indo< siQe <ith this option is ! %7 *ytes. This option is negotiated at the
start of the TCP connectionE and can *e sent in a pac#et only <ith the S? flag. ?ote that <hile an JT.
discovery process allo<s optimal setting of the maximumGreceiveGsegmentGsiQe optionE no corresponding
*and<idth delay product discovery allo<s the relia*le automated setting of the <indo<Gscale option 4%5.
DSACK-permitted option and SACK option : This option alters the ac#no<ledgment *ehavior of TCP.
-CM is an acronym for selective acknowledgment . The -CMGpermitted option is offered to the remote
end during TCP setup as an option to an opening S? pac#et. The -CM option permits selective
ac#no<ledgment of permitted data. The default TCP ac#no<ledgment *ehavior is to ac#no<ledge the
highest seLuence num*er of inorder *ytes. This default *ehavior is prone to cause unnecessary
retransmission of dataE <hich can exacer*ate a congestion condition that may have *een the cause of the
original pac#et loss. The -CM option allo<s the receiver to modify the ac#no<ledgment field to
descri*e noncontinuous *loc#s of received dataE so that the sender can retransmit only <hat is missing at
the receiverUs end 4&5.
-ny ro*ust highGperformance implementation of TCP should negotiate these parameters at the
start of the TCP sessionE ensuring the follo<ing: that the session is using the largest possi*le "P pac#et
siQe that can *e carried <ithout fragmentationE that the <indo< siQes used in the transfer are adeLuate for
the *and<idthGdelay product of the net<or# pathE and that selective ac#no<ledgment can *e used for
rapid recovery from lineGerror conditions or from short periods of marginally degraded net<or#
performance.
TCP O*erat%!&
The first phase of a TCP session is esta*lishment of the connection. This reLuires a three<ay
handsha#eE ensuring that *oth sides of the connection have an unam*iguous understanding of the
seLuence num*er space of the remote side for this session. The operation of the connection is as follo<s:
The local system sends the remote end an initial seLuence num*er to the remote portE using a S?
pac#et. The remote system responds <ith an -CM of the initial seLuence num*er and the initial seLuence
num*er of the remote end in a response S? pac#et. The local end responds <ith an -CM of this remote
seLuence num*er. The connection is opened. The operation of this algorithm is sho<n in ,igure !. The
performance implication of this protocol exchange is that it ta#es one and a half round3trip times (2TTs)
for the t<o systems to synchroniQe state *efore any data can *e sent.
54
-fter the connection has *een esta*lishedE the TCP protocol manages the relia*le exchange of
data *et<een the t<o systems. The algorithms that determine the various retransmission timers have *een
redefined numerous times. TCP is a slidingG<indo< protocolE and the general principle of flo< control is
*ased on the management of the advertised <indo< siQe and the management of retransmission timeoutsE
attempting to optimiQe protocol performance <ithin the o*served delay and loss parameters of the
connection. Tuning a TCP protocol stac# for optimal performance over a very lo<GdelayE highG*and<idth
/-? reLuires different settings to o*tain optimal performance over a dialup "nternet connectionE <hich in
turn is different for the reLuirements of a highGspeed <ideGarea net<or#. -lthough TCP attempts to
discover the delay *and<idth product of the connectionE and attempts to automatically optimiQe its flo<
rates <ithin the estimated parameters of the net<or# pathE some estimates <ill not *e accurateE and the
corresponding efforts *y TCP to optimiQe *ehavior may not *e completely successful. -nother critical
aspect is that TCP is an adaptive flo<Gcontrol protocol. TCP uses a *asic flo<Gcontrol algorithm of
increasing the dataGflo< rate until the net<or# signals that some form of saturation level has *een reached
(normally indicated *y data loss). @hen the sender receives an indication of data lossE the TCP flo< rate
is reduced) <hen relia*le transmission is reesta*lishedE the flo< rate slo<ly increases again.
"f no relia*le flo< is reesta*lishedE the flo< rate *ac#s further off to an initial pro*e of a single
pac#etE and the entire adaptive flo<Gcontrol process starts again. This process has numerous results
relevant to service Luality. ,irstE TCP *ehaves adaptively E rather than predictively . The flo<Gcontrol
algorithms are intended to increase the dataGflo< rate to fill all availa*le net<or# path capacityE *ut they
are also intended to Luic#ly *ac# off if the availa*le capacity changes *ecause of interaction <ith other
trafficE or if a dynamic change occurs in the endGtoGend net<or# path. ,or exampleE a single TCP flo<
across an other<ise idle net<or# attempts to fill the net<or# path <ith dataE optimiQing the flo< rate
<ithin the availa*le net<or# capacity. "f a second TCP flo< opens up across the same pathE the t<o flo<G
control algorithms <ill interact so that *oth flo<s <ill sta*iliQe to use approximately half of the availa*le
capacity per flo<. The o*$ective of the TCP algorithms is to adapt so that the net<or# is fully used
<henever one or more data flo<s are present. "n designE tension al<ays exists *et<een the efficiency of
net<or# use and the enforcement of predicta*le session performance. @ith TCPE you give up predicta*le
throughput *ut gain a highly utiliQedE efficient net<or#.
I&tera)t%e TCP
"nteractive protocols are typically directed at supporting single character interactionsE <here each
character is carried in a single pac#etE as is its echo. The protocol interaction
to support this is indicated in ,igure.
These ! *ytes of data generate four TCPO"P pac#etsE or 1:7 *ytes of protocol overhead. TCP
ma#es some small improvement in this exchange through the use of piggybacking E <here an -CM is
carried in the same pac#et as the dataE and delayed acknowledgment E <here an -CM is delayed up to !77
ms *efore sendingE to give the server application the opportunity to generate data that the -CM can
piggy*ac#. The resultant protocol exchange is indicated in ,igure.
,or shortGdelay /-?sE this protocol exchange offers accepta*le performance. This protocol
exchange for a single data character and its echo occurs <ithin a*out 1: ms on an Ethernet /-?E
corresponding to an interactive rate of :7 characters per second. @hen the net<or# delay is increased in a
@-?E these small pac#ets can *e a source of congestion load. The TCP mechanism to address this smallG
pac#et congestion <as descri*ed *y ]ohn ?agle in 2,C NK: 4'5. Commonly referred to as the Nagle
Algorithm E this mechanism inhi*its a sender from transmitting any additional small segments <hile the
TCP connection has outstanding unac#no<ledged small segments. 1n a /-?E this modification to the
algorithm has a negligi*le effect) in contrastE on a @-?E it has a dramatic effect in reducing the num*er
55
of small pac#ets in direct correlation to the net<or# path congestion level (as sho<n in ,igures ' and :).
The cost is an increase in session $itter *y up to a roundGtrip time interval. -pplications that are $itterG
sensitive typically disa*le this control algorithm.
TCP is not a highly efficient protocol for the transmission of interactive traffic. The typical
carriage efficiency of the protocol across a /-? is ! *ytes of payload and 1!7 *ytes of protocol overhead.
-cross a @-?E the ?agle algorithm may improve this carriage efficiency slightly *y increasing the
num*er of *ytes of payload for each payload transactionE although it <ill do so at the expense of
increased session $itter.
C!&)$<1%!&
TCP is not a predictive protocol. "t is an adaptive protocol that attempts to operate the net<or# at
the point of greatest efficiency. Tuning TCP is not a case of ma#ing TCP pass more pac#ets into the
net<or#. Tuning TCP involves recogniQing ho< TCP senses current net<or# load conditionsE <or#ing
through the inevita*le compromise *et<een ma#ing TCP highly sensitive to transient net<or# conditionsE
and ma#ing TCP resilient to <hat can *e regarded as noise signals. "f the performance of endGtoGend TCP
is the perceived pro*lemE the most effective ans<er is not necessarily to add ^o service differentiation
into the net<or#. 1ftenE the greatest performance improvement can *e made *y upgrading the <ay that
hosts and the net<or# interact through the appropriate configuration of the host TCP stac#s. "n the next
article on this topicE <e <ill examine ho< TCP is facing ne< challenges <ith increasing use of <irelessE
shortGlived connectionsE and *and<idthGlimited mo*ile devicesE as <ell as the continuing effort for
improved TCP performance. @eUll loo# at a num*er of proposals to change the standard actions of TCP to
meet these various reLuirements and ho< they <ould interact <ith the existing TCP protocol.
56

You might also like