[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Creating my own TCP



I think TCP receives packets through _C++_ method TcpAgent::recv(), it's not
available
in OTcl.

- Haobo

> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]]On Behalf Of Karim
> Benjelloun
> Sent: Tuesday, August 31, 1999 1:59 PM
> To: [email protected]
> Subject: Creating my own TCP
>
>
> Hello everybody,
>
> I would like to personalize the current TcpAgent by
> creating a subclass (say MyTcp) which  prints the seqno
> everytime it receives a pkt. My idea was to create a
> subclass extending TcpAgent, and redefine the virtual
> procedure 'recv' to do the job.
> Here is my listing :
>
> ----------------------------------------------------
> set ns [new Simulator]
> ### Procedures
> proc finish {} {
>     global ns
>     $ns flush-trace
>     exit 0
> }
> Class MyTcp -superclass { Agent/TCP }
> MyTcp instproc recv {pkt Handler} {
>     eval $self next $pkt $Handler
>     puts "pkt [$self seqno_]"
> }
> ### Nodes
> set n0 [$ns node]
> set n1 [$ns node]
> ### Links
> $ns duplex-link $n0 $n1 2MB 560ms DropTail
> ### TCPs
> set src [new MyTcp]
>    $ns attach-agent $n0 $src
> set dst [new Agent/TCPSink]
>    $ns attach-agent $n1 $dst
> $ns connect $src $dst
> ### FTP
> set ftp01 [new Application/FTP]
> $ftp01 attach-agent $src
> ###Scheduler
> $ns at 0.1 "$ftp start"
> $ns at 60 "$ftp stop"
> $ns at 60.1 "finish"
> $ns run
> ----------------------------------------------------
>
> The simulator runs fine, but no result appears on the
> screen.
>
> Thanks for help !
>
>                 Karim
>
> ______________________________________________________
> Bo�te aux lettres - Caramail - http://www.caramail.com
>
>