[ns] how to send a pkt in 2.1b8a
Rute Sofia
rsofia@seas.upenn.edu
Thu Apr 4 18:05:02 2002
Hi,
you can set the dst address directly, if you know it:
ip->dst_addr_=(nsaddr_t)<node destination address>;
ip->dst_.port_=(int)<node destination port>;
however, you need a connect between your two agents:
$ns connect $agentsrc $agentdst
or
$ns simplex-connect $agentsrc $agentdst
Without it, you'll get the "no target for slot xpto".
check out tcl/lib/*.tcl files for these functions
Best Regards
Rute Sofia
Lee wro
>
>Hi,
>
>I failed to send a packet to dst.
>no target for slot -1
>Would you like to tell me how to setthe destination address of a packet?
>Thanks.
>
>Lee
>
>I tried:
>
> int dst; // the destination id
>
> hdr_ip* ip = (hdr_ip*) hdr_ip::access(p);
> ip->dst_.addr_ = idtoaddr(dst);
>
>or
>
> dst_.addr_ = idtoaddr(dst);
>
>nsaddr_t QLSU::idtoaddr(int id)
>{
> return id << Address::instance().NodeShift_[1];
>}
>