Reputation: 81
I need to find the IP address of my node in my code. Currently, I have this line:this line:
IPv4Address addr = nb_ipv4->GetAddress (maininterface , 0);
In this line, I expect to get the IP address for my main interface, but instead I see this error:
error:conversion from 'ns3::Ipv4InterfaceAddress' to non-scalar type 'ns3::Ipv4Address'
Can anyone help me to solve this error?
Upvotes: 1
Views: 372
Reputation: 1128
I think that must be tagged as C++, and (if it is The ns-3 network simulator) you must do this:
IPv4Address addr = nb_ipv4->GetAddress(maininterface).GetLocal();
Upvotes: 3