Hi
it is not working.... let me explain the problem i have...
suppose i have three nodes A(10.1.1.1), B(10.1.1.2), and C(10.1.1.4).
Initially, all nodes create a socket for listening to incoming
connection request using the following code
CanNode::StartApplication (void)
{
NS_LOG_FUNCTION_NOARGS ();
if (m_socket == 0)
{
TypeId tid = TypeId::LookupByName ("ns3::UdpSocketFactory");
m_socket = Socket::CreateSocket (GetNode(), tid);
InetSocketAddress local = InetSocketAddress
(Ipv4Address::GetAny (),9);
m_socket->Bind (local);
}
m_socket->SetRecvCallback(MakeCallback(&CanNode::HandleRead, this));
m_socket->SetAcceptCallback ( MakeNullCallback<bool, Ptr<Socket>,
const Address &> (),
MakeCallback(&CanNode::HandleAccept, this));
ScheduleTransmit (Seconds(0.));
}
Node C sends a packet to node B using the following socket code
if (m_socket1 == 0)
{
TypeId tid = TypeId::LookupByName ("ns3::UdpSocketFactory");
m_socket1 = Socket::CreateSocket (GetNode(), tid);
m_socket1->Bind ();
m_socket1->Connect (InetSocketAddress ("10.1.1.2", 9));
}
m_socket1->SetRecvCallback(MakeCallback(&CanNode::HandleRead,
this));
m_socket1->SetAcceptCallback ( MakeNullCallback<bool, Ptr<Socket>,
const Address &> (),
MakeCallback(&CanNode::HandleAccept, this));
m_socket1->Send (p);
B receives the packet correctly...no problem
but when B wants to forward the same packet to node A using the
following code:
Ptr<Socket> outSocket = Socket::CreateSocket(GetNode(),
TypeId::LookupByName ("ns3::UdpSocketFactory"));
NS_ASSERT(outSocket != 0);
NS_ASSERT(outSocket->Bind() == 0);
NS_ASSERT(outSocket->Connect(InetSocketAddress("10.1.1.1",9)) ==
0);
outSocket->SetRecvCallback(MakeCallback
(&InitialCanNode::HandleRead, this));
outSocket->SetAcceptCallback ( MakeNullCallback<bool, Ptr<Socket>,
const Address &> (),
MakeCallback(&InitialCanNode::HandleAccept, this));
outSocket->Send(packet);
the simulator gives me the following error:
assert failed. file=../src/common/packet-tag-list.cc, line=139,
cond="cur->tid != tag.GetInstanceTypeId ()"
Command ['/home/Derar/ns-allinone-3.5/ns-3.5/build/debug/scratch/
firstcan'] exited with code -11
if i change the port number from 9 to any number the packet is sent
but ICMP is sent from C to B because the port is unreachable.
The same socket code is working when node c send a packet to node B,
but it is not working when node B forward the same packet to node A.
any suggestion please...i need a help
On Dec 15, 5:37 am, Mathieu Lacage <
mathieu.lac...@gmail.com> wrote:
> Mathieu Lacage <
mathieu.lac...@gmail.com>