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

Re: [ns] Lloyd Wood



On Thu, 25 Jan 2001, Michele R. wrote:

> you said me "increase a counter with your own recvBytes() method in TcpSink"
> but i don't understand what is recvBytes()!

[Well, use grep and find on the ns tree and find out.]

it's a C++ method in tcp-sink.cc, that gets called whenever the
sink has some bytes to deliver to the application:

        if (numToDeliver)
                recvBytes(numToDeliver);

It's defined in agent.h as:
virtual void recvBytes(int bytes);

which is just a callback to the application's recv() function, as
you'll see in agent.cc. You don't actually have an application riding
TcpSink, so you just override and replace recvBytes (hey, it's
virtual) to do something useful for you, i.e. record the number of
bytes it's being passed in the passed variable.


> i'd like to have anything variable that says me how many bytes my
> tcpsink had received from tcpsender and after i'd like to put them
> in a file.tr to plot my trhoughput....

So create your own bound variable, increment it in recvBytes, and
record it at regular intervals via a trace procedure. You'll need to
write Tcl and C++ for that.

You can't do what you want in Tcl alone. As I keep saying, there
should be a default way of doing this via Tcl... if you've got more
than one sink, my method of just printing out bytes received every
time they're received gets useless fast - but if you've got one sink
and you want exact times without the overhead of Tcl tracing, it's
ideal.

L.

<[email protected]>PGP<http://www.ee.surrey.ac.uk/Personal/L.Wood/>