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

Re: Unicast to different agents?



At 2:27 AM +0800 11/10/98, Lam Chi Yung wrote:
>Hello,
>	I am a newbie to ns. I would like to build an agent which
>communicates with agents in different nodes.
>
>	I am deriving a class from UDP. Problem arises, however. Suppose
>I have the following scenario:
>
>	Agent A is in Node 1
>	Agent B is in Node 2
>	Agent C is in Node 3
>
>	I would like A to send packets to B and C. It is not successful
>for some cases, though.
>
>	Is there a way to send packets to agents in different nodes?
>Many thanks!


I _think_ if you change the dest portion of your Packets' ip_hdr
just before you send them, they should get routed to appropriate places.
I have a similar Agent class I am creating to emulate something like
the use of "sendto()" for UDP packets.  Of course, A will need to somehow
know the ns addresses of B&C ahead of time ... same problem you have in the 
real world.

Example code I'm planning to try ... I've done a similar thing for 
multicast and it works (Look at the the Agent::initpkt() code in "agent.cc" 
for how this
is normally done when packets are "allocated" by a source Agent.

Packet *p = allocpkt();
nsaddr_t destination_address = "wherever";
hdr_ip::access(p)->dest() = destination_address;

send(p, 0);

>
>Yours,
>Chi-yung

best regards,
Brian
__________________________________
Brian Adamson
<http://manimac.itd.nrl.navy.mil>
<mailto://[email protected]>