I am trying to convert the manet-routing-compare.cc to python.
For setup SetupPacketReceive function, I convert it as:
def SetupPacketReceive(addr, node):
tid = ns.core.TypeId.LookupByName("ns3::UdpSocketFactory")
sink = ns.network.Socket.CreateSocket(node, tid)
local = ns.network.InetSocketAddress(ns.network.Ipv4Address(addr), port.value)
print(local)
sink.Bind(local)
sink.SetRecvCallback(ns.core.MakeCallback(ReceivePacket(sink)))
return sink
I am getting the following error:
sink.Bind(local)
TypeError: none of the 2 overloaded methods succeeded. Full details:
int ns3::Socket::Bind(const ns3::Address& address) =>
TypeError: could not convert argument 1
int ns3::Socket::Bind() =>
TypeError: takes at most 0 arguments (1 given)
The Bind function in Socket can not take argument.
How can i bind a local address to a socket?