[ns] how to send a pkt in 2.1b8a
Fri Apr 5 05:15:03 2002
I once worked in 2.1b5
I could send a packet by
setting ip->dst_ to the address of the dest,
and then callingtarget_->recv(p);
I do not need to connect the two agents.
There are some changes in ns2.1b8a, the ip.h
And I am not sure how to determine the dst_.port_
Or, is connecting two agents a requirement in 2.1b8a
for the two agents to communicate?
On Thu, 4 Apr 2002, Rute Sofia wrote:
> 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
> $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
> >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?
> >I tried:
> > int dst; // the destination id
> > hdr_ip* ip = (hdr_ip*) hdr_ip::access(p);
> > ip->dst_.addr_ = idtoaddr(dst);
> > dst_.addr_ = idtoaddr(dst);
> >nsaddr_t QLSU::idtoaddr(int id)
> > return id << Address::instance().NodeShift_;