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

Re: how to get the throughput out for ftp application/tcp agent,



Hello Zhiwei,

If an application is attached to an TCPSink agent, the agnet will call
the application's recv(bytes) method whenever it received and ACKed
segments. So you can write an application in TCL to record the
throughput.

The following code declear a new TCL class - "TraceApp" and implement
an instproc - "recv". Currently, it just record the total bytes the
receiver has received and ACKed and store it to variable bytes_.
You can add anything as you like.

Class TraceApp -superclass Application

TraceApp instproc init {args} {
        $self set bytes_ 0
        eval $self next $args
}

TraceApp instproc recv {byte} {
        $self instvar bytes_
        set bytes_ [expr $bytes_ + $byte]
        return $bytes_
}

The instproc "recv" will be called automatically whenever TCPSink
received and ACKed sengments if you attached TraceApp to the TCPSink.
The following code will do this.

set sink [new Agent/TCPSink]
TraceApp traceapp
traceapp attach-agent $sink

Good luck.

ZX>  Hi, there:
ZX>     without postprocessing the trace file, how to get the
ZX> sender/receiver's throughput for the ftp application over tcp agent? is
ZX> there any sample code? thanks in advance!

ZX> xiao




Best regards,
 Huang                            mailto:[email protected]