Hi all,
I created an CBR traffic from source_0 to destination_2.
Two nodes are in the range, in the recv function of my routing
protocol node_2 does not receive the packet. But it received by the
application layer.
Could you please tell me what is wrong with it?
Below is the way I created CBR as traffic and recv function:
Regards,
Amir
void
Protoname::recv(Packet* p, Handler* h) {
struct hdr_cmn* ch = HDR_CMN(p);
struct hdr_ip* ih = HDR_IP(p);
int src = Address::instance().get_nodeaddr(ih->saddr());
int dst = ch->next_hop();
printf("Node_%d received a packet\n",ra_addr());
}
set udp_(0) [new Agent/UDP]
$ns_ attach-agent $node_(0) $udp_(0)
set null_(0) [new Agent/Null]
$ns_ attach-agent $node_(2) $null_(0)
set cbr_(0) [new Application/Traffic/CBR]
$cbr_(0) set packetSize_ 512
$cbr_(0) set interval_ 900
$cbr_(0) set random_ 1
$cbr_(0) set maxpkts_ 1
$cbr_(0) attach-agent $udp_(0)
$ns_ connect $udp_(0) $null_(0)
$ns_ at 1.0 "$cbr_(0) start"
____________________________________________________________________
Amir Darehshoorzadeh | Comp. Architecture Dept.
PhD Student | UPC-Campus Nord, D6-008
Email: [email protected] | c/ Jordi Girona, 1-3
Tel: +34 93 401 7182 | 08034 Barcelona - SPAIN
http://personals.ac.upc.edu/amir
_____________________________________________________________________