Socket Reply For IPRawSocket

16 views
Skip to first unread message

Faris Syariati

unread,
Jul 20, 2016, 12:42:38 AM7/20/16
to ns-3-users
Dear All.

I have a question about replying packet using existing socket when IPRawSocket.
I tried to mimic the usage of UDPServerEcho implementation on my own packet sink, however, the reply does not arrive at the sender application. 

Though, I can do a reply using existing socket, but I need to rebind and reconnect the socket to the sender again, but the problems come after.

rplSocket->Bind();
rplSocket->Connect(m_currReplFrom);
rplSocket->Listen();
rplSocket->SetSendCallback(MakeCallback(&MultipathPacketSink::SendReplySuccess, this));
rplSocket->Send(packet);

These lines is called on my sink application do do the reply. But there is a problem.
After calling this codes, the reply arrives on the sender, but the Sink will get (received) the same packet again on HandleRead function. So what happen is even though the sender only send the packet one time literally, the receiver get the packet 2 times (1 times after sending the reply). 

My question is, how can I send the reply without getting any problem ? 

Thank you.

Tommaso Pecorella

unread,
Jul 20, 2016, 6:00:20 AM7/20/16
to ns-3-users
Hi,

I understand that English is not your main language, but we need to understand the problem to help you.
Please consider getting some help from someone more fluent in English.

Beside that, you don't want to use Connect on a listening socket. This is not a ns-3 thing, it's a basic socket programming rule.

T.
Reply all
Reply to author
Forward
0 new messages