12.07.2015 Views

The ns Manual (formerly ns Notes and Documentation)1 - NM Lab at ...

The ns Manual (formerly ns Notes and Documentation)1 - NM Lab at ...

The ns Manual (formerly ns Notes and Documentation)1 - NM Lab at ...

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

emove-all-packet-headers;add-packet-header IP TCP;set <strong>ns</strong> [new Simul<strong>at</strong>or];$<strong>ns</strong> use-scheduler Heap;# removes all packet headers# adds TCP/IP headers# i<strong>ns</strong>tanti<strong>at</strong>e the Simul<strong>at</strong>or# use the Heap scheduler# SETUP TOPOLOGY# cre<strong>at</strong>e nodesset n(0) [$<strong>ns</strong> node]set n(1) [$<strong>ns</strong> node]# cre<strong>at</strong>e link$<strong>ns</strong> duplex-link $n(0) $n(1) 10Mb 0ms DropTail# SETUP PACKMIMEset r<strong>at</strong>e 15set pm [new PackMimeHTTP]$pm set-client $n(0);$pm set-server $n(1);$pm set-r<strong>at</strong>e $r<strong>at</strong>e;$pm set-http-1.1;# name $n(0) as client# name $n(1) as server# new connectio<strong>ns</strong> per second# use HTTP/1.1# SETUP PACKMIME RANDOM VARIABLESglobal defaultRNG# cre<strong>at</strong>e RNGs (appropri<strong>at</strong>e RNG seeds are assigned autom<strong>at</strong>ically)set flowRNG [new RNG]set reqsizeRNG [new RNG]set rspsizeRNG [new RNG]# cre<strong>at</strong>e R<strong>and</strong>omVariablesset flow_arrive [new R<strong>and</strong>omVariable/PackMimeHTTPFlowArrive $r<strong>at</strong>e]set req_size [new R<strong>and</strong>omVariable/PackMimeHTTPFileSize $r<strong>at</strong>e $CLIENT]set rsp_size [new R<strong>and</strong>omVariable/PackMimeHTTPFileSize $r<strong>at</strong>e $SERVER]# assign RNGs to R<strong>and</strong>omVariables$flow_arrive use-rng $flowRNG$req_size use-rng $reqsizeRNG$rsp_size use-rng $rspsizeRNG# set PackMime variables$pm set-flow_arrive $flow_arrive$pm set-req_size $req_size$pm set-rsp_size $rsp_size# record HTTP st<strong>at</strong>istics$pm set-outfile "d<strong>at</strong>a-test-packmime.d<strong>at</strong>"$<strong>ns</strong> <strong>at</strong> 0.0 "$pm start"$<strong>ns</strong> <strong>at</strong> 30.0 "$pm stop"$<strong>ns</strong> run367

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!