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

Re: [ns] Polling vs. Message Passing? (fwd)




Thanks for the suggestion, but I still have a few lingering questions: 

#1. I don't quite understand the mechanism by which the example receiver
Application would be getting data from the Agent [in my case TCPSink]. In
other words, which piece of the Agent's code would be calling the
Application's 'recv' function upon the reception of new packets? This
doesn't occur automatically, or does it?? 

#2. I took a look at the 'Application'(s) in ns-source.tcl, but their
communication with their attached agent is always unidirectional, ie:
'[$self agent] send $nbytes', '[$self agent] advance $pktcnt', etc. None
of the sample applications that I have seen have any awareness of received
packets, or do any decision making upon packet reception. If such an
application were to exist, could anybody point me in its direction? 

#3. How can I modify an agent, let's say TCPSink, to communicate with its
controlling application upon the occurence of an event, rather than having
the controlling application simply poll the Agent's state variables?

It might be a little more helpful if I describe what I'm doing. I have a
'worm' type application that randomly attempts to infect other nodes. If
one of the contacted nodes is infectible, then a number of new tcp agents,
tcpsink agents, and worm applications are created upon the reception of
all the worm packets. This traffic attempts to infect other nodes, etc. My
problem is that I have a loop that increases every INTERVAL fractions of a
second and checks to see if all the worm packets have been received at an
infected node, so that I know when to spawn the new worm traffic. As you
can imagine, this method results in horrific system performance.

Any ideas?

Many thanks for enduring such a long post,
-Stan


On Fri, 4 Jan 2002, Xuan Chen wrote:

> 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
> 
>