Question

I try to get length of queue in MAC layer into aodv protocol by ns2 but when I recall if queue->length() function , got "Segmentation Fault".

I searched how to get length of queue in MAC layer and got the cause of it is returned zero value every time.

unfortunately I didn't find any correct answer to solve it ! I did following steps :

 in AODV::recvHello(Packet *p){
 ....
 double length;
 length=ifqueue->length();
 ...
 }

but when I run the simulation file for wireless , got segmentation fault(core dumped) in output!

I try to recall it every where of AODV but I got same error!

could you please guide me where i am doing wrong ?

Was it helpful?

Solution

I solved it finally. when Length() function defined as protected this error shown. so I define it as public and this problem solved :)

but for solving any error on tcl you can use following command :

valgrid --track-check=yes ns filename.tcl

after running this command you can see position and cause of errors. I used it to find cause of my problem and saw "memory stack". this means the program can't access to memory for protected function!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top