why does routingTable->getRouterId() return a <unspeci> address at the begening of simulation?

37 views
Skip to first unread message

Lu Tongxing

unread,
Mar 10, 2017, 5:34:00 AM3/10/17
to OMNeT++ Users

Hi, friends,  i use UDPBasicApp and i have a question about the routingTable, i use the the getSelfAddress() function to get the host address.

IPvXAddress UDPBasicAppCam::getSelfAddress() const
{
    return routingTable->getRouterId();
}

but if I put the getSelfAddress()   function in initialize() function, at the begening, it returns a <unspeci> address. but later it works well.

if i put the getSelfAddress()  in processStart() function, it works well always.

Can someone help me to explain it? 




Michael Kirsche

unread,
Mar 12, 2017, 3:20:24 PM3/12/17
to OMNeT++ Users
The address is initialized during the general initialization process of the simulation. All modules have their own initialize() functions, where they get their parameters assigned and so on.
The self-address you try to get is probably assigned somewhere in a different initialize() function of another protocol or module.
The processStart() function is called much later during the simulation, where presumably all parameters (and your address) is set.
Reply all
Reply to author
Forward
0 new messages