I am trying to set up a Multihop AdHoc 802.11g Network in ns-3.
To get started I used the example 'wifi-simple-adhoc-grid.cc'.
The example uses UDP, but I want to use TCP. Therefore I switched
TypeId tid = ns3::UdpSocketFactory::GetTypeId();
Ptr<Socket> recvSink = Socket::CreateSocket (c.Get (sinkNode), tid);
InetSocketAddress local = InetSocketAddress (Ipv4Address::GetAny (), 80);
recvSink->Bind (local);
recvSink->SetRecvCallback (MakeCallback (&ReceivePacket));
to
TypeId tid = ns3::TcpSocketFactory::GetTypeId();
Ptr<Socket> recvSink = Socket::CreateSocket (c.Get (sinkNode), tid);
InetSocketAddress local = InetSocketAddress (Ipv4Address::GetAny (), 80);
recvSink->Bind (local);
recvSink->SetRecvCallback (MakeCallback (&ReceivePacket));
Ptr<Socket> source = Socket::CreateSocket (c.Get (sourceNode), tid);
InetSocketAddress remote = InetSocketAddress (i.GetAddress (sinkNode, 0), 80);
Sending Packets is no Problem, but ReceivePacket is never called, which means, that socket Sink receives no packets.
The whole code: https://gist.github.com/3023757
Routes output by:
Ptr<OutputStreamWrapper> routingStream = Create<OutputStreamWrapper>
("wifi-multihop.routes", std::ios::out)
You can call SetRevCallback function your SetAcceptCallback function.
Explicitly,
In the accept function