[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [ns] Polling vs. Message Passing? (fwd)
you may find the following description helpful. Thanks.
-chen
---------- Forwarded message ----------
Date: 04 Jan 2002 11:55:25 -0800
From: Tim Buchheim <[email protected]>
To: Xuan Chen <[email protected]>
Subject: Re: [ns] Polling vs. Message Passing? (fwd)
On Thu, 2002-01-03 at 20:12, Xuan Chen wrote:
...
This guy wants a way to know when a certain number of packets have been
received "at a particular node" (I'm guessing he really means "by a
particular agent")
I think he can do this by creating an Application to count packets.
Create an Application object in tcl. Then use instproc to give it a recv
method which counts packets and does something when the magic number is
reached.
Something like this would probably work (but I haven't tried it)
set app [new Application]
# install a recv method on this object. If more than one is needed, then
# an actual subclass of Application would be a good idea.
$app instproc recv {num_bytes} {
$self instvar count
incr count
if {$count > $some_number} then {
# do something
}
}
$app attach-agent $receiving_agent
# receiving_agent is the agent receiving the packets
> ---------- Forwarded message ----------
> Date: Thu, 3 Jan 2002 19:12:48 -0500 (EST)
> From: Stanley M Bielski <[email protected]>
> To: [email protected]
> Subject: [ns] Polling vs. Message Passing?
>
>
> Hi all,
>
> I'm running a simulation that requires new agents to spawn after X number
> of packets have been received at particular nodes of interest. I've found
> that the only way I can do this so far is by using a loop that
> periodically checks the highest acknowledgement received. Unfortunately,
> this is seriously degrading my system performance.
>
> Are there any wait & notify / message-passing methods in Tcl or OTcl to
> get around this? How about C++?
>
> Many Thanks
> -Stan
--
Tim Buchheim