Suspend Tcp / Tcp Socket From Sending Packet and Start It Again

58 views
Skip to first unread message

Faris Syariati

unread,
Aug 18, 2016, 5:14:58 AM8/18/16
to ns-3-users
Dear All.

I have a question related to my shim layer implementation between TCP and IP.

In my current implementation, I set the tcp DownTarget to my own function for the shim layer sender side.

m_senderTcp->SetDownTarget(MakeCallback(&MpTransmissionProtocol::ScheduleSendTcpPacketDown, this));

Then. In the ShceduleSendTcpPacketDown

I want to have a situation when tcp need to wait from sending next packet until the situation is allowed, without dropping the packet.

void
MpTransmissionProtocol::ScheduleSendTcpPacketDown(Ptr<Packet> packet, Ipv4Address source,
Ipv4Address destination, uint8_t protocol, Ptr<Ipv4Route> route)
{
//bool sendSuccess = false;
if (!m_mpPktGen->IsFull())
{
//Add packet to packet buffer, then do scheduling event
m_senderIpv4->Send(refPacket, source, mpDestination, protocol, route);
}
else
{
                //Tell Tcp to stop sending
                m_senderSocket->ShutdownSend();
m_stopSending = true;
NS_LOG_ERROR("Buffer Full");
}
}

Here what I already try is using socket->ShutDownSend() but I am not sure it is a proper implementation. 

The next one, I need to Inform the TCP to start sending again, I tried to call the socket->Listen() at some part of my code after the event triggered, but it looks like the socket still shutdown after I call that function.

If I am not wrong, my supervisor said there must be a way to inform the tcp to stop sending because the TCP will hold for a while if buffer in lower layer is full. So I need to reflect to that method on ns3. May I get informed how can I implement the functionality like given situation  in my case?

Thank you. 

Nat P

unread,
Aug 18, 2016, 5:27:21 AM8/18/16
to ns-3-users
Currently, backpressure in TCP is not implemented, so it has no way to stop sending. It will transmit anyway, if its window allows a transmission.
You can hack in some way, by fooling tcp into having a rwnd of 0, and discarding all its probing packets.

But, to be honest, I would prefer something more classy, you can take a look into the backpressure in traffic control and copy that. Look at the documentation; to port it to tcp, simply mentally map traffic control with tcp and netdevice with your level.

Following that, it would be awesome if the backpressure is implemented between Tcp and traffic-control....

Nat

Faris Syariati

unread,
Aug 18, 2016, 5:53:45 AM8/18/16
to ns-3-users
Dear Nat

Please correct me. 
In case I would like to change rwnd, It is enough just changing the the tcp header's window size? I saw in the tcp-socket-base header.GetWindowSize() is applied to rwnd. 
May I know where the tcp probing packet implemented ? 

Thank You. 
Reply all
Reply to author
Forward
0 new messages