Things just don't work that way

Study the tutorials mentioned here:
http://inesc-0.tagus.ist.utl.pt/~pmsrve/ns2/ns2_beginners.html#_Toc128325749


> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
> Of Robert Luke
> Sent: terça-feira, 14 de Março de 2006 15:24
> To: ns-users
> Subject: [ns] Newbie ns-2/OTcl question
> 
> 
> I am still a newbie at ns-2 and have a question that is driving me
> crazy.  I have set up a very simple ns-2 simulation in which there are
> two nodes connected by a duplex link.  I am sending a single FTP
> packet from one node to the other.  I've attached the ns-2 input code
> to the end of this email.
> 
> My question is this:  I can get an object handle for the $ftp0 object
> by including a statement that says
> 
>     puts "ftp0 = $ftp0"
> 
> But how can I "catch" that single ftp packet in OTcl as it is being
> sent so that I can find the object handle for that packet and print
> out some of its attributes such as size, contents, class, superclass,
> etc.?
> 
> This has got to be such a simple question but I can't for the life of
> me figure it out.  And I keep veering into looking at the C++ code to
> try to figure it out and that way lies madness.  :-)
> 
> I'd be grateful for any hints.
> 
> Thanks,
> -Robert
> 
> 
> 
> 
> 
>  ------ ns-2 input file -----------
> 
>   set ns [new Simulator]
>   set tf [open out.tr w]
>   $ns trace-all $tf
>   set nf [open out.nam w]
>   $ns namtrace-all $nf
> 
>   # Nodes and link
> 
>   set n0 [$ns node]
>   set n1 [$ns node]
> 
>   $ns duplex-link $n0 $n1 2.0Mb 100ms DropTail
>   $ns duplex-link-op $n0 $n1 orient right
>   $ns queue-limit $n0 $n1 20
> 
>   # TCP agent connection
> 
>   set tcp0 [new Agent/TCP]
>   $ns attach-agent $n0 $tcp0
> 
>   set sink0 [new Agent/TCPSink]
>   $ns attach-agent $n1 $sink0
> 
>   $ns connect $tcp0 $sink0
> 
>   # FTP application over TCP connection.
> 
>   set ftp0 [new Application/FTP]
>   $ftp0 attach-agent $tcp0
> 
>   # 'Finish' proc.
> 
>   proc Finish {} {
>      global nf ns tf
>      close $tf
>      close $nf
>     exec nam out.nam &
>     exit 0
>   }
> 
>  # Event sequence
> 
>  $ns at 0.5 "$ftp0 produce 1"
>  $ns at 10.0 "Finish"
> 
>  $ns run


Reply via email to