Sie sind auf Seite 1von 30

TCL script for creating nodes, duplex link, orientation, Label and Queue.

Description:
This network consists of 3 nodes (Client1, Router1 and Endserver1). The duple link !etween Client1 and Router1 has " #!ps of !andwidth and 1$$ %s of dela&. The duple link !etween Router1 and Endserver1 has "$$'!ps of !andwidth and 1$$ %s of dela&. Each link !etween nodes uses a Drop Tail (ueue.
)ile na%e: *tcp1.tcl+ ,-------Event scheduler o!.ect creation--------, set ns [new Simulator]

,----------creatin/ na% o!.ects----------------, set nf [open tcp1.nam w] ns namtrace!all nf "open t#e trace file set nt [open tcp1.tr w] ns trace!all nt set proto rlm ns color 1 blue ns color $ %ellow ns color & red ,---------- creatin/ client- router- end server node----------------, set Client1 [ ns node] set 'outer1 [ ns node] set (ndser)er1 [ ns node]

,---creatin/ duple link---------, ns duplex!link Client1 'outer1 $*b 1++ms ,ropTail ns duplex!link 'outer1 (ndser)er1 $++-b 1++ms ,ropTail

,----------------creatin/ orientation------------------, ns duplex!link!op Client1 'outer1 orient rig#t ns duplex!link!op 'outer1 (ndser)er1 orient rig#t ,------------0a!ellin/----------------, ns at +.+ . Client1 label Client1. ns at +.+ . 'outer1 label 'outer1. ns at +.+ . (ndser)er1 label (ndser)er1. ,-----------Confi/urin/ nodes------------, (ndser)er1 s#ape #exagon 'outer1 s#ape s/uare ,----------------Esta!lishin/ (ueues---------, " ns duplex!link!op Client1 'outer1 /ueue0os +.1 " ns duplex!link!op 'outer1 (ndser)er1 /ueue0os +.1 ,---------finish procedure--------, proc finis# 23 2 global ns nf nt ns flus#!trace close nf close nt puts .running nam.... exec nam tcp1.nam 4 exit + 3 "Calling finis# procedure ns at 5.+ .finis#. ns run ,-----1ow to run-----, ns tcp1.tcl

TCL script for bandwidt# and dela% configuration between 6odes

Description:
This network consists of 2 nodes (Client1, Router1, Client", Router" and Endserver1). The duple link !etween Client1 and Router1 has " #!ps of !andwidth and 3$%s of dela&. The duple link !etween Router1 and Endserver1 has 1$$'!ps of !andwidth and 1$$ %s of dela&. The duple link !etween Client" and Router" has 1$$'!ps !andwidth and 3$%s dela&. The duple link !etween Router" and Endserver1 has 1$$'!ps !andwidth and 1$$%s of dela&. Each link !etween nodes uses a DropTail (ueue.
)ile na%e: *tcp".tcl+ ,-------Event scheduler o!.ect creation--------, set ns [new Simulator] ,-----------creatin/ na% o!.ect---------, set nf [open tcp$.nam w] ns namtrace!all nf set nt [open tcp$.tr w] ns trace!all nt set proto rlm ns color 1 red ns color $ blue ,---------- creatin/ client- router- end server node----------------, set Client1 [ ns node] set 'outer1 [ ns node] set (ndser)er1 [ ns node] set Client$ [ ns node] set 'outer$ [ ns node] ,---creatin/ duple link---------,

ns duplex!link ns duplex!link ns duplex!link ns duplex!link

Client1 'outer1 Client$ 'outer$

'outer1 $*b 1+ms ,ropTail (ndser)er1 1++-b 1++ms ,ropTail 'outer$ 1++-b 1+ms ,ropTail (ndser)er1 1++-b 1++ms ,ropTail

,----------------creatin/ orientation------------------, ns duplex!link!op ns duplex!link!op ns duplex!link!op ns duplex!link!op Client1 'outer1 orient rig#t 'outer1 (ndser)er1 orient rig#t (ndser)er1 'outer$ orient rig#t 'outer$ Client$ orient rig#t

,------------Creatin/ 0a!elin/----------------, ns at +.+ . ns at +.+ . ns at +.+ . ns at +.+ . ns at +.+ . Client1 label Client1. 'outer1 label 'outer1. (ndser)er1 label (ndser)er1. 'outer$ label 'outer$. Client$ label Client$.

,-----------Confi/urin/ nodes------------, (ndser)er1 s#ape #exagon 'outer1 s#ape s/uare 'outer$ s#ape s/uare ,----------------Esta!lishin/ (ueues---------, ns duplex!link!op ns duplex!link!op ns duplex!link!op ns duplex!link!op Client1 'outer1 Client$ 'outer$ 'outer1 /ueue0os +.1 (ndser)er1 /ueue0os +.1 'outer$ /ueue0os +.1 (ndser)er1 /ueue0os +.1

,---------finish procedure--------, proc finis# 23 2 global ns nf nt ns flus#!trace close nf puts .running nam.... exec nam tcp$.nam 4 exit + 3 "Calling finis# procedure

ns at 1.+ .finis#. ns run

,-----1ow to run-----, ns tcp$.tcl

TCL script to create a network which consists of eight nodes then set the bandwidth, delay and queue size of the link between the nodes

Description:
This network consists of 4 nodes (Client1, Client", Client3, Router1, Router" Router3, Router2, Endserver1,). The duple links !etween Client1,Client",Client3 and Router1 have " #!ps of !andwidth and 1$$ %s of dela&. The duple link !etween Router1 and Router" has "$$#!ps of !andwidth and 1$$ %s of dela&. The duple link !etween Router" and Router3 has "$$#!ps of !andwidth and 1$$ %s of dela&. The duple link !etween Router3 and Router2 has "$$#!ps of !andwidth and 1$$ %s of dela&. The duple link !etween Router2 and Endserver1 has "$$#!ps of !andwidth and 1$$ %s of dela&. Each node uses a DropTail (ueue, of which the %a i%u% si5e is 1$$.
)ile na%e: *tcp3.tcl+ ,-------Event scheduler o!.ect creation--------, set ns [new Simulator ] ,----------creatin/ na% o!.ects----------------, set nf [open tcp&.nam w] ns namtrace!all nf "open t#e trace file set nt [open tcp&.tr w] ns trace!all nt set proto rlm ns color 11 blue ns color 1$ %ellow ns color 1& red ,----- creatin/ client- router- end server node---------, set Client1 [ ns node] set Client$ [ ns node] set Client& [ ns node] set 'outer1 [ ns node] set 'outer$ [ ns node] set 'outer& [ ns node] set 'outer7 [ ns node]

set (ndser)er1 [ ns node] "set (ndser)er$ [ ns node] ,---creatin/ duple link---------, ns duplex!link Client1 'outer1 $*b 1++ms ,ropTail ns duplex!link Client$ 'outer1 $*b 1++ms ,ropTail ns duplex!link Client& 'outer1 $*b 1++ms ,ropTail ns duplex!link 'outer1 'outer$ 1++-b 1++ms ,ropTail ns duplex!link 'outer$ 'outer& 1++-b 1++ms ,ropTail ns duplex!link 'outer& 'outer7 $++-b 1++ms ,ropTail ns duplex!link 'outer7 (ndser)er1 $++-b 1++ms ,ropTail " ns duplex!link 'outer7 (ndser)er$ $++-b 1++ms ,ropTail ,----------------creatin/ orientation--------------------, ns duplex!link!op ns duplex!link!op ns duplex!link!op ns duplex!link!op ns duplex!link!op ns duplex!link!op ns duplex!link!op Client1 Client$ Client& 'outer1 'outer$ 'outer& 'outer7 'outer1 orient down!rig#t 'outer1 orient rig#t 'outer1 orient up!rig#t 'outer$ orient up!rig#t 'outer& orient down!rig#t 'outer7 orient rig#t (ndser)er1 orient up

,------------0a!elin/----------------, ns at +.+ . ns at +.+ . ns at +.+ . ns at +.+ . ns at +.+ . ns at +.+ . ns at +.+ . ns at +.+ . Client1 label Client1. Client$ label Client$. Client& label Client&. 'outer1 label 'outer1. 'outer$ label 'outer$. 'outer& label 'outer&. 'outer7 label 'outer7. (ndser)er1 label (ndser)er1.

,-----------Confi/urin/ nodes------------, " " " " " (ndser)er1 s#ape #exagon 'outer1 s#ape s/uare 'outer$ s#ape s/uare 'outer& S#ape s/uare 'outer7 S#ape s/uare

,----------------Esta!lishin/ (ueues---------,

ns duplex!link!op ns duplex!link!op ns duplex!link!op ns duplex!link!op ns duplex!link!op ns duplex!link!op ns duplex!link!op

Client1 Client$ Client& 'outer1 'outer$ 'outer& 'outer7

'outer1 /ueue0os +.1 'outer1 /ueue0os +.1 'outer1 /ueue0os +.1 'outer$ /ueue0os +.1 'outer& /ueue0os +.1 'outer7 /ueue0os +.1 (ndser)er1 /ueue0os +.1

,---------finish procedure--------, proc finis# 23 2 global ns nf nt puts .running nam.... exec nam tcp&.nam 4 exit + 3 ,Callin/ finish procedure ns at &1.+ .finis#. ns run

,-----1ow to run-------------, ns tcp&.tcl

TCL script to set identification color to links

Description:
This network consists of 6 nodes (C1, C", C3, C2, R1, R", R3, R2, R781, R78" and R783). The duple links !etween C1, C", C3, R1, R", R3 and R781 have " #!ps of !andwidth and 1$$ %s of dela&. The duple link !etween C1 and R781 has 1#!ps of !andwidth and 1$%s of dela&. The duple link !etween C" and R781 has 3$$'!ps of !andwidth and 1$%s of dela&. The duple link !etween C3 and R781 has 93$'!ps of !andwidth and 1$%s of dela&. The duple link !etween C2 and R781 has 1#!ps of !andwidth and 1$%s of dela&. The duple link !etween R1 and R781, R" and R781, R3 and R781, R2 and R783 has 1#!ps of !andwidth and 1$%s of dela&. Each link uses a DropTail (ueue.
)ile na%e: *tcp2.tcl+ ,-------Event scheduler o!.ect creation--------, set ns [ new Simulator ] ,------------ CRE:T;<= <:# 7>?ECT@ -----------------, set nf [open tcp7.nam w] ns namtrace!all nf "8pen t#e trace file set nt [open tcp7.tr w] ns trace!all nt

set proto rlm ,------------C707R DE@CR;AT;7<---------------, ns color 1 dodgerblue ns color $ red ns color & c%an ns color 7 green ns color 1 %ellow ns color 5 black ns color 9 magenta ns color : gold ns color ; red

, --------- CRE:T;<= @E<DER - RECE;BER - R78TER <7DE@-----------, set C1 [ ns node] set C$ [ ns node] set C& [ ns node] set C7 [ ns node] set '1 [ ns node] set '$ [ ns node] set '& [ ns node] set '7 [ ns node] set '8<1 [ ns node] set '8<$ [ ns node] set '8<& [ ns node] , --------------CRE:T;<= D8A0EC 0;<' -----------------------, ns duplex!link ns duplex!link ns duplex!link ns duplex!link ns duplex!link ns duplex!link ns duplex!link ns duplex!link ns duplex!link ns duplex!link ns duplex!link C1 '8<1 1*b 1+ms ,ropTail C$ '8<1 1++-b 1+ms ,ropTail C& '8<1 91+-b 1+ms ,ropTail C7 '8<$ 1*b 1+ms ,ropTail '1 '8<1 1*b 1+ms ,ropTail '$ '8<1 1*b 1+ms ,ropTail '& '8<1 1*b 1+ms ,ropTail '7 '8<& 1*b 1+ms ,ropTail '8<$ '8<1 1*b 1+ms ,ropTail '8<$ '8<& 1*b 1+ms ,ropTail '8<1 '8<& 1*b 1+ms ,ropTail

,-------------D8E8E @;EE DE@CR;AT;7<---------------, ns /ueue!limit ns /ueue!limit ns /ueue!limit ns /ueue!limit '8<1 '8<1 '8<$ '8<& '8<$ 1: '8<& 1: '8<1 $+ '8<1 $+

,-----------CRE:T;<= 7R;E<T:T;7< -------------------------, ns duplex!link!op ns duplex!link!op ns duplex!link!op ns duplex!link!op ns duplex!link!op ns duplex!link!op ns duplex!link!op ns duplex!link!op C1 C$ C& C7 '1 '$ '& '7 '8<1 orient down '8<1 orient down!rig#t '8<1 orient down!left '8<$ orient up '8<1 orient up '8<1 orient up!rig#t '8<1 orient up!left '8<& orient down

ns duplex!link!op '8<1 '8<$ orient down!rig#t ns duplex!link!op '8<& '8<$ orient down!rig#t

, --------------0:>E00;<= -----------------------------, ns at +.+ . ns at +.+ . ns at +.+ . ns at +.+ . ns at +.+ . ns at +.+ . ns at +.+ . ns at +.+ . ns at +.+ . ns at +.+ . ns at +.+ . C1 label CL1. C$ label CL$. C& label CL&. C7 label CL7. '1 label 'C1. '$ label 'C$. '& label 'C&. '7 label 'C7. '8<1 label '8<1. '8<$ label '8<$. '8<& label '8<&.

, --------------- C7<);=8R;<= <7DE@ -----------------, '8<1 s#ape s/uare '8<$ s#ape s/uare '8<& s#ape s/uare , ----------------D8E8E@ A7@;T;7<;<= :<D E@T:>0;@1#E<T -------------, ns duplex!link!op '8<$ '8<1 /ueue0os +.1 " ns duplex!link!op '8<$ C1 /ueue0os +.1 ns duplex!link!op '8<& '8<1 /ueue0os +.1

,--------@ETT;<= ;DE<T;);C:T;7< C707R@ T7 R78TER-0;<'@----------, ns duplex!link!op '8<1 '8<$ color c%an ns duplex!link!op '8<1 '8<& color c%an ns duplex!link!op '8<$ '8<& color c%an

, ---------------- );<;@1 AR7CED8RE -------------, proc finis# 23 2

global ns nf nt nf1 ns flus#!trace close nf puts .running nam.... exec nam Tcp7.nam 4 exit + 3 ,Callin/ finish procedure ns at $+.+ .finis#. ns run ,--------1ow to run---------, ns tcp7.tcl

TCL script to create Tcp agent, Tcp sink and attach the Tcp agent with Tcpsink .

Description:
This network consists of 2 nodes (Client1, Router1, Endserver1 and Endserver"). The duple link !etween Client1and Router1 has " #!ps of !andwidth and 1$$ %s of dela&. The duple link !etween Router1 and Endserver1 has 1$$'!ps of !andwidth and 1$$ %s of dela&. The duple link !etween Router1 and Endserver" has "$$'!ps of !andwidth and 1$$ %s of dela&. Each node uses a DropTail (ueue. : FTCAF a/ent is attached to Client1. FTCA@inkF a/ent is attached to Endserver1 and Endserver". TCA and TCA@ink a/ent is connected. :s default, the %a i%u% si5e of a packet that a FTCAF a/ent can /enerate is 1$$$!&tes. : tcp FsinkF a/ent /enerates and sends :C' packets to the sender (tcp a/ent) and frees the received packets. The ftp is set to start at $.3$ sec and stop at 4.3 sec.
)ile na%e: *tcpred1.tcl+ ,-------Event scheduler o!.ect creation--------, set ns [new Simulator] "!!!!!!!!!!creatin/ na% o!.ects!!!!!!!!!!!!!!!!" set nf [open tcpred1.nam w] ns namtrace!all nf "open t#e trace file set nt [open tcpred1.tr w] ns trace!all nt set proto rlm ns color 1 blue ns color $ %ellow ns color & red "!!!!!!! creatin/ client- router- end server node!!!!!!!!!!!" set Client1 [ ns node] set 'outer1 [ ns node] set (ndser)er1 [ ns node] set (ndser)er$ [ ns node] "!!!creatin/ duple link!!!!!!!!!"

ns duplex!link Client1 'outer1 $*b 1++ms ,ropTail ns duplex!link 'outer1 (ndser)er1 1++-b 1++ms ,ropTail ns duplex!link 'outer1 (ndser)er$ $++-b 1++ms ,ropTail "!!!!!!!!!!!!!!!!creatin/ orientation!!!!!!!!!!!!!!!!!!" ns duplex!link!op Client1 'outer1 orient rig#t ns duplex!link!op 'outer1 (ndser)er1 orient up!rig#t ns duplex!link!op 'outer1 (ndser)er$ orient down!rig#t

"!!!!!!!!!!!!0a!elin/!!!!!!!!!!!!!!!!" ns at +.+ . ns at +.+ . ns at +.+ . ns at +.+ . Client1 label Client1. 'outer1 label 'outer1. (ndser)er1 label (ndser)er1. (ndser)er$ label (ndser)er$.

,-----------Confi/urin/ nodes------------, (ndser)er1 s#ape #exagon (ndser)er$ s#ape #exagon 'outer1 s#ape s/uare ,----------------Esta!lishin/ (ueues---------, " " " " ns duplex!link!op ns duplex!link!op ns duplex!link!op ns duplex!link!op Client1 Client$ 'outer1 'outer$ 'outer1 /ueue0os +.1 'outer1 /ueue0os +.1 'outer$ /ueue0os +.1 (ndser)er1 /ueue0os +.1

,---------Esta!lishin/ co%%unication-------------, ,-------------Client1 to Endserver1!!!" set tcp+ [new =gent>TC0] tcp+ set maxcwnd? 15 tcp+ set fid? 1 ns attac#!agent Client1 tcp+

set sink+ [new =gent>TC0Sink] ns attac#!agent (ndser)er1 sink+ ns connect tcp+ sink+ set ftp+ [new =pplication>@T0] ftp+ attac#!agent tcp+ ns add!agent!trace tcp+ tcp tcp+ trace)ar cwnd? ns at +.1+ . ftp+ start. ns at :.1 . ftp+ stop. ,-------------Client1 to Endserver"---, set tcp1 [new =gent>TC0] tcp1 set maxcwnd? 15 tcp1 set fid? $ ns attac#!agent Client1 tcp1 set sink1 [new =gent>TC0Sink] ns attac#!agent (ndser)er$ sink1 ns connect tcp1 sink1 set ftp1 [new =pplication>@T0] ftp1 attac#!agent tcp1 ns add!agent!trace tcp1 tcp tcp+ trace)ar cwnd? ns at +.1+ . ftp1 start. ns at :.1 . ftp1 stop.

,---------finish procedure--------, proc finis# 23 2 global ns nf nt ns flus#!trace close nf puts .running nam.... exec nam Tcpred1.nam 4 exit + 3 "Calling finis# procedure ns at 1+.+ .finis#. ns run ,--------- how to e ecute the pro/ra%!!!!!!!!!!!" G ns tcpred1.tcl

TCL script for TCP communication between two Clients and a Endserver

Description:
This network consists of 2 nodes (Client1, Client", Router1, Rounter" and Endserver1). The duple links !etween Client1 Client" and Router1have " #!ps of !andwidth and 1$$ %s of dela&. The duple link !etween Router1 and Router" has "#!ps of !andwidth and 1$$ %s of dela&. The duple link !etween Router" and Endserver1 has "$$'!ps of !andwidth and 1$$ %s of dela&. Each link uses a Drop Tail (ueue. : FTCAF a/ent is attached to Client1, and Client". FTCA@inkF a/ent is attached to Endserver1. >oth the a/ents are connected. :s default, the %a i%u% si5e of a packet that a FTCAF a/ent can /enerate is 1$$$!&tes. : FTCA@inkF a/ent /enerates and sends :C' packets to the sender (tcp a/ent) and frees the received packets. The ftp is set to start at $.3 sec and stop at 3.3 sec.
)ile na%e: *tcpred1.tcl+ ,-------Event scheduler o!.ect creation--------, set ns [new Simulator] ,----------creatin/ na% o!.ects----------------, set nf [open tcpred1.nam w] ns namtrace!all nf "open t#e trace file set nt [open tcpred1.tr w] ns trace!all nt set proto rlm ns color 1 blue ns color $ %ellow ns color & red ,---------- creatin/ client- router- end server node----------------, set Client1 [ ns node] set Client$ [ ns node] set 'outer1 [ ns node] set 'outer$ [ ns node] set (ndser)er1 [ ns node]

,---creatin/ duple link---------, ns duplex!link ns duplex!link ns duplex!link ns duplex!link Client1 Client$ 'outer1 'outer$ 'outer1 $*b 1++ms ,ropTail 'outer1 $*b 1++ms ,ropTail 'outer$ $*b 1++ms ,ropTail (ndser)er1 $++-b 1++ms ,ropTail

,----------------creatin/ orientation------------------, ns duplex!link!op ns duplex!link!op ns duplex!link!op ns duplex!link!op Client1 Client$ 'outer1 'outer$ 'outer1 orient down 'outer1 orient rig#t 'outer$ orient rig#t (ndser)er1 orient down

,------------0a!ellin/----------------,

ns at +.+ . ns at +.+ . ns at +.+ . ns at +.+ . ns at +.+ .

Client1 label Client1. Client$ label Client$. 'outer1 label 'outer1. 'outer$ label 'outer$. (ndser)er1 label (ndser)er1.

,-----------Confi/urin/ nodes------------, (ndser)er1 s#ape #exagon 'outer1 s#ape s/uare 'outer$ s#ape s/uare ,----------------Esta!lishin/ (ueues---------, ns duplex!link!op ns duplex!link!op ns duplex!link!op ns duplex!link!op Client1 Client$ 'outer1 'outer$ 'outer1 /ueue0os +.1 'outer1 /ueue0os +.1 'outer$ /ueue0os +.1 (ndser)er1 /ueue0os +.1

,---------Esta!lishin/ co%%unication-------------, ,-------------Client1 to Endserver1---, set tcp+ [new =gent>TC0] tcp+ set maxcwnd? 15

tcp+ set fid? 1 ns attac#!agent Client1 tcp+ set sink+ [new =gent>TC0Sink] ns attac#!agent (ndser)er1 sink+ ns connect tcp+ sink+ set ftp+ [new =pplication>@T0] ftp+ attac#!agent tcp+ ns add!agent!trace tcp+ tcp tcp+ trace)ar cwnd? ns at +.1 . ftp+ start. ns at 1.1 . ftp+ stop.

set tcp1 [new =gent>TC0] tcp1 set maxcwnd? 15 tcp1 set fid? $ ns attac#!agent Client$ tcp1 set sink1 [new =gent>TC0Sink] ns attac#!agent (ndser)er1 sink1 ns connect tcp1 sink1 set ftp1 [new =pplication>@T0] ftp1 attac#!agent tcp1 ns add!agent!trace tcp1 tcp tcp1 trace)ar cwnd? ns at +.1 . ftp1 start. ns at 1.1 . ftp1 stop.

,---------finish procedure--------, proc finis# 23 2 global ns nf nt

ns flus#!trace close nf close nt puts .running nam.... exec nam tcpred1.nam 4 exit + 3 ,Callin/ finish procedure ns at 5.+ .finis#. ns run

,-------- 1ow to run-----------, ns tcpred$.tcl

TCL script for TCP communication between four Clients and a Endserver

Description:
This network consists of 4 nodes (Client1, Client", Client3, Client2, Router1, Router" Router3, Router2, Router3, RouterH and Endserver1,). The duple links !etween Client1, Client", Client3, Client2 and Router1 have 3 #!ps of !andwidth and 3$ %s of dela&. The duple link !etween Router1 and Router" has 3#!ps of !andwidth and 3$ %s of dela&. The duple link !etween Router" and Router3 has 13$'!ps of !andwidth and 3$ %s of dela& and etc. )inall& the duple link !etween RouterH and Endserver1 has 3$$'!ps of !andwidth and 3$ %s of dela&. Each link uses a DropTail (ueue. : FTCAF a/ent is attached to Client1, Client", Client3, Client2 and a connection is esta!lished to a *TCA@inkF a/ent attached to Endserver1. :s default, the %a i%u% si5e of a packet that a FTCAF a/ent can /enerate is 1$$$!&tes. : FTCA@inkF a/ent /enerates and sends :C' packets to the sender (tcp a/ent) and frees the received packets. The ftp is set to start at $.3$ sec and stop at "4.3 sec.
)ile na%e: *tcpred3.tcl+ ,-------Event scheduler o!.ect creation--------, set ns [ new Simulator] , ----------- CRE:T;<= <:# 7>?ECT@ -----------------, set nf [open Tcpred&.nam w] ns namtrace!all nf "8pen t#e trace file set nt [open Tcpred&.tr w] ns trace!all nt set proto rlm ns color 1 red ns color $ blue ns color & %ellow ns color 7 c%an ns color 1 maroon , --------- CRE:T;<= C0;E<T - R78TER -E<D@ERBER <7DE@-----------,

set Client1 [ ns node] set Client$ [ ns node] set Client& [ ns node] set Client7 [ ns node] set 'outer1 [ ns node] set 'outer$ [ ns node] set 'outer& [ ns node] set 'outer7 [ ns node] set 'outer1 [ ns node] set 'outer5 [ ns node] set (ndser)er1 [ ns node] , --------------CRE:T;<= D8A0EC 0;<' -----------------------, ns duplex!link Client1 'outer1 1*b 1+ms ,ropTail ns duplex!link Client$ 'outer1 1*b 1+ms ,ropTail ns duplex!link Client& 'outer1 1*b 1+ms ,ropTail ns duplex!link Client7 'outer1 1*b 1+ms ,ropTail ns duplex!link 'outer1 'outer$ 1*b 1+ms ,ropTail ns duplex!link 'outer$ 'outer& 11+-b 1+ms ,ropTail ns duplex!link 'outer& 'outer7 &++-b 1+ms ,ropTail ns duplex!link 'outer7 'outer1 1++-b 1+ms ,ropTail ns duplex!link 'outer1 'outer5 &++-b 1+ms ,ropTail ns duplex!link 'outer5 (ndser)er1 &++-b 1+ms ,ropTail " ns duplex!link 'outer5 (ndser)er$ &++-b 1+ms ,ropTail

,-----------CRE:T;<= 7R;E<T:T;7< -------------------------, ns duplex!link!op Client1 'outer1 orient down!rig#t ns duplex!link!op Client$ 'outer1 orient rig#t ns duplex!link!op Client& 'outer1 orient up!rig#t ns duplex!link!op Client7 'outer1 orient up ns duplex!link!op 'outer1 'outer$ orient rig#t ns duplex!link!op 'outer$ 'outer& orient down ns duplex!link!op 'outer& 'outer7 orient rig#t ns duplex!link!op 'outer7 'outer1 orient up ns duplex!link!op 'outer1 'outer5 orient rig#t ns duplex!link!op 'outer5 (ndser)er1 orient up!rig#t " ns duplex!link!op 'outer5 (ndser)er$ orient rig#t

, --------------CRE:T;<= 0:>E00;<= -----------------------------,

ns at +.+ . Client1 label Client1. ns at +.+ . Client$ label Client$. ns at +.+ . Client& label Client&. ns at +.+ . Client7 label Client7. ns at +.+ . 'outer1 label 'outer1. ns at +.+ . 'outer$ label 'outer$. ns at +.+ . 'outer& label 'outer&. ns at +.+ . 'outer7 label 'outer7. ns at +.+ . 'outer1 label 'outer1. ns at +.+ . 'outer5 label 'outer5. ns at +.+ . (ndser)er1 label (ndser)er. " ns at +.+ . (ndser)er$ label (ndser)er$. , --------------- C7<);=8R;<= <7DE@ -----------------, (ndser)er1 s#ape #exagon 'outer1 s#ape box 'outer$ s#ape s/uare 'outer& s#ape s/uare 'outer7 s#ape s/uare 'outer1 s#ape s/uare 'outer5 s#ape s/uare , ----------------E@T:>0;@1;<= D8E8E@ -------------, ns duplex!link!op ns duplex!link!op ns duplex!link!op ns duplex!link!op ns duplex!link!op ns duplex!link!op ns duplex!link!op ns duplex!link!op ns duplex!link!op ns duplex!link!op Client1 Client$ Client& Client7 'outer1 'outer$ 'outer& 'outer7 'outer1 'outer5 'outer1 /ueue0os +.1 'outer1 /ueue0os +.1 'outer1 /ueue0os +.1 'outer1 /ueue0os +.1 'outer$ /ueue0os +.1 'outer& /ueue0os +.1 'outer7 /ueue0os +.1 'outer1 /ueue0os +.1 'outer5 /ueue0os +.1 (ndser)er1 /ueue0os +.1

, ----------------E@T:>0;@1;<= C7##8<;C:T;7< -------------, ,-------C0;E<T1 T7 E<D@ERBER1 -------------, set tcp+ [new =gent>TC0] tcp+ set maxcwnd? 15 tcp+ set fid? 7 ns attac#!agent Client1 tcp+

set sink+ [new =gent>TC0Sink] ns attac#!agent (ndser)er1 sink+ ns connect tcp+ sink+ set ftp+ [new =pplication>@T0] ftp+ attac#!agent tcp+ ns add!agent!trace tcp+ tcp tcp+ trace)ar cwnd? ns at +.1 . ftp+ start. ns at $:.1 . ftp+ stop. , ---------------- C0;E<T" T7 E<D@ERBER1 -------------,

set tcp1 [new =gent>TC0] tcp1 set fid? $ tcp1 set maxcwnd? 15 ns attac#!agent Client$ tcp1 set sink1 [new =gent>TC0Sink] ns attac#!agent (ndser)er1 sink1 ns connect tcp1 sink1 set ftp1 [new =pplication>@T0] ftp1 attac#!agent tcp1 ns add!agent!trace tcp1 tcp1 tcp1 trace)ar cwnd? ns at +.1: . ftp1 start. ns at $:.1 . ftp1 stop. , ----------------C0;E<T3 T7 E<D@ERBER1------------,

set tcp$ [new =gent>TC0] tcp$ set fid? + tcp$ set maxcwnd? 15 tcp$ set packetsiAe? 1++ ns attac#!agent Client& tcp$

set sink$ [new =gent>TC0Sink] ns attac#!agent (ndser)er1 sink$ ns connect tcp$ sink$ set ftp$ [new =pplication>@T0] ftp$ attac#!agent tcp$ ns add!agent!trace tcp$ tcp$ tcp$ trace)ar cwnd? ns at +.51 . ftp$ start. ns at $:.1 . ftp$ stop. ,--------------------C0;E<T2 T7 E<D@ERBER1----------------, set tcp& [new =gent>TC0] tcp& set fid? & tcp& set maxcwnd? 15 tcp$ set packetsiAe? 1++ ns attac#!agent Client7 tcp& set sink& [new =gent>TC0Sink] ns attac#!agent (ndser)er1 sink& ns connect tcp& sink& set ftp& [new =pplication>@T0] ftp& attac#!agent tcp& ns add!agent!trace tcp& tcp& tcp& trace)ar cwnd? ns at +.5+ . ftp& start. ns at $:.1 . ftp& stop.

, ---------------- );<;@1 AR7CED8RE -------------, proc finis# 23 2

global ns nf nt ns flus#!trace

close nf puts .running nam.... exec nam Tcpred&.nam 4 exit + 3 ,Callin/ finish procedure ns at 11.+ .finis#. ns run ,----------1ow to run-------------, ns tcpred7.tcl

TCL script for TCP communication between more numbers of nodes

Description:
This network consists of 6 nodes (C1, C", C3, C2, R1, R", R3, R2, R781, R78" and R783). The duple link !etween the links is confi/ured with specific !andwidth and dela&. Each link uses a DropTail (ueue. : FTCAF a/ent is attached to C1 and a connection is esta!lished to a tcp FTCA@inkF a/ent attached to R2. : FTCAF a/ent is attached to C" and a connection is esta!lished to a tcp FTCA@inkF a/ent attached to R3. : a/ent is attached to C3 and a connection is esta!lished to a FTCA@inkF a/ent attached to R":s default, the %a i%u% si5e of a packet that a FTCAF a/ent can /enerate is 1$$$!&tes. : FTCAF a/ent is attached to C2 and a connection is esta!lished to a FTCA@inkF a/ent attached to R1 : FTCA@inkF a/ent /enerates and sends :C' packets to the sender (tcp a/ent) and frees the received packets. :pplication ftp is attached to all FTCAF a/ents for packet /eneration. The ftp is set to start at $." sec and stop at 2.$ sec.
)ile na%e: *tcpred3.tcl+ ,-------Event scheduler o!.ect creation--------, set ns [ new Simulator ,------------ CRE:T;<= <:# 7>?ECT@ -----------------, set nf [open tcpred1.nam w] ns namtrace!all nf "8pen t#e trace file set nt [open tcpred1.tr w] ns trace!all nt

set proto rlm ,------------C707R DE@CR;AT;7<---------------, ns color 1 dodgerblue ns color $ red ns color & c%an ns color 7 green ns color 1 %ellow ns color 5 black

ns color 9 magenta ns color : gold ns color ; red

, --------- CRE:T;<= @E<DER - RECE;BER - R78TER <7DE@-----------, set C1 [ ns node] set C$ [ ns node] set C& [ ns node] set C7 [ ns node] set '1 [ ns node] set '$ [ ns node] set '& [ ns node] set '7 [ ns node] set '8<1 [ ns node] set '8<$ [ ns node] set '8<& [ ns node]

, --------------CRE:T;<= D8A0EC 0;<' -----------------------, ns duplex!link ns duplex!link ns duplex!link ns duplex!link ns duplex!link ns duplex!link ns duplex!link ns duplex!link C1 C$ C& C7 '1 '$ '& '7 '8<1 1*b 1+ms ,ropTail '8<1 1++-b 1+ms ,ropTail '8<1 91+-b 1+ms ,ropTail '8<$ 1*b 1+ms ,ropTail '8<1 1*b 1+ms ,ropTail '8<1 1*b 1+ms ,ropTail '8<1 1*b 1+ms ,ropTail '8<& 1*b 1+ms ,ropTail

ns duplex!link '8<$ '8<1 1*b 1+ms ,ropTail ns duplex!link '8<$ '8<& 1*b 1+ms ,ropTail ns duplex!link '8<1 '8<& 1*b 1+ms ,ropTail "!!!!!!!!!!!!!Q<(<( SBC( ,(SC'B0TB86!!!!!!!!!!!!!!!" ns /ueue!limit ns /ueue!limit ns /ueue!limit ns /ueue!limit '8<1 '8<1 '8<$ '8<& '8<$ 1: '8<& 1: '8<1 $+ '8<1 $+

,-----------CRE:T;<= 7R;E<T:T;7< -------------------------,

ns duplex!link!op ns duplex!link!op ns duplex!link!op ns duplex!link!op ns duplex!link!op ns duplex!link!op ns duplex!link!op ns duplex!link!op

C1 C$ C& C7 '1 '$ '& '7

'8<1 orient down '8<1 orient down!rig#t '8<1 orient down!left '8<$ orient up '8<1 orient up '8<1 orient up!rig#t '8<1 orient up!left '8<& orient down

ns duplex!link!op '8<1 '8<$ orient down!rig#t ns duplex!link!op '8<& '8<$ orient down!rig#t " ns /ueue!limit n1 11

" !!!!!!!!!!!!!!L=D(LLB6E !!!!!!!!!!!!!!!!!!!!!!!!!!!!!" ns at +.+ . ns at +.+ . ns at +.+ . ns at +.+ . ns at +.+ . ns at +.+ . ns at +.+ . ns at +.+ . ns at +.+ . ns at +.+ . ns at +.+ . C1 label CL1. C$ label CL$. C& label CL&. C7 label CL7. '1 label 'C1. '$ label 'C$. '& label 'C&. '7 label 'C7. '8<1 label '8<1. '8<$ label '8<$. '8<& label '8<&.

, --------------- C7<);=8R;<= <7DE@ -----------------, '8<1 s#ape s/uare '8<$ s#ape s/uare '8<& s#ape s/uare , ----------------D8E8E@ A7@;T;7<;<= :<D E@T:>0;@1#E<T -------------, ns duplex!link!op '8<$ '8<1 /ueue0os +.1 " ns duplex!link!op '8<$ C1 /ueue0os +.1 ns duplex!link!op '8<& '8<1 /ueue0os +.1

,--------@ETT;<= ;DE<T;);C:T;7< C707R@ T7 R78TER-0;<'@----------, ns duplex!link!op '8<1 '8<$ color c%an ns duplex!link!op '8<1 '8<& color c%an ns duplex!link!op '8<$ '8<& color c%an

, ----------------E@T:>0;@1;<= C7##8<;C:T;7< -------------, ,--------------TCA C7<<ECT;7< >ETIEE< <7DE@---------------, " " " " " tcp+ set fid? & Dase1 set fid? & tcp+ set window? 11 ftp+ set packetSiAe? 1+++ ftp+ set inter)al? .+1

set tcp1 [ ns create!connection TC0 C1 TC0Sink '7 1] tcp1 set class? 1 tcp1 set maxcwnd? 15 tcp1 set packetsiAe? 7+++ tcp1 set fid? 1 set ftp1 [ tcp1 attac#!app @T0] ftp1 set inter)al? .++1 ns at +.$ . ftp1 start. ns at 7.+ . ftp1 stop. set tcp$ [ ns create!connection TC0 C$ TC0Sink '& 1] tcp$ set class? 1 tcp$ set maxcwnd? 15 tcp$ set packetsiAe? 7+++ tcp$ set fid? $ set ftp$ [ tcp$ attac#!app @T0] ftp$ set inter)al? .++1 ns at +.9 . ftp$ start. ns at 7.+ . ftp$ stop. set tcp& [ ns create!connection TC0 C& TC0Sink '$ 1] tcp& set class? 1 tcp& set maxcwnd? 15 tcp& set packetsiAe? 7+++ tcp& set fid? & set ftp& [ tcp& attac#!app @T0] ftp& set inter)al? .++1 ns at 1.$ . ftp& start.

ns at 7.+ . ftp& stop. set tcp7 [ ns create!connection TC0 C7 TC0Sink '1 1] tcp7 set class? 1 tcp7 set maxcwnd? 15 tcp7 set packetsiAe? 7+++ tcp7 set fid? 7 set ftp7 [ tcp7 attac#!app @T0] ftp1 set inter)al? .++1 ns at $.1 . ftp7 start. ns at 7.+ . ftp7 stop. , ---------------- );<;@1 AR7CED8RE -------------, proc finis# 23 2 global ns nf nt nf1 ns flus#!trace close nf puts .running nam.... exec nam Tcpred1.nam 4 exit + 3 ,Callin/ finish procedure ns at $+.+ .finis#. ns run ,-----1ow to run-----, ns tcpred1.tcl

Das könnte Ihnen auch gefallen