Dear friend,

Try to use printf statement. i.e. *printf("src_node_id:%d",index);*

You can also print the destination id at the same time by *
printf("src_node_id:%d\t**dst_node_id:%d**",index,dst);*

If you add this line in the AODV::sendRequest function then, you will be
having information regarding to RREQ only. So below I have shown you the
place of this line for your purpose for your better understanding,..

In aodv.cc,

...
...
AODV::sendRequest(nsaddr_t dst){
*printf("src_node_id:%d\t**dst_node_id:%d**",index,dst);   //added line**
*// Allocate a RREQ packet
Packet *p = Packet::alloc();
struct hdr_cmn *ch = HDR_CMN(p);
...
...

Save the file and recompile ns2 by using *make* command before running the
tcl script same as you did after your changes.

Moreover if you are able to analyze the trace file, then also you can
verify the sequence of simulation by more better way.

Hope it helps.......

On Wed, Nov 9, 2011 at 11:06 PM, shoaib saleem <[email protected]> wrote:

>
> Hello ,
>
> I am using NS2 simulator. Right now i am working on AODV protocol. My
> scenario is a simple one with 3 nodes. What i want is to display the each
> node id on command line to understand the sequence of the packets (RREQ,
> RREP and RERR) generation when i run the command "ns myfile.tcl"  on
> command line.
>
> The IP address of a node is declared as "nsaddr_t index;"  in aodv.h. what
>  i have done is that in aodv.cc , i have "cout<<index; " in the following
> function.
>
> void
>
> 01042 <http://rp.lip6.fr/ns-doc/ns226-doc/html/classAODV.htm#AODVb18>
> AODV::sendRequest
> <http://rp.lip6.fr/ns-doc/ns226-doc/html/classAODV.htm#AODVb18>(nsaddr_t
> dst)
>
>
> After that i have recompiled ns2. When i run the simulation there is not
> output on the command line. Thanks in Advance.
> Shoaib
>
>
> <https://sites.google.com/site/shoaibsal/>
>



-- 
With kind regards...
Pathik Shah

Reply via email to