--
Posting to this group should follow these guidelines https://www.nsnam.org/wiki/Ns-3-users-guidelines-for-posting
---
You received this message because you are subscribed to the Google Groups "ns-3-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ns-3-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ns-3-users/9316643c-0221-4cdf-81f5-31e1da53b852%40googlegroups.com.
Hope it can help.
Socket->Connect (InetSocketAddress (servAddress, servPort));Socket->SetSendCallback (MakeCallback (&WriteUntilBufferFull)); //Call WriteUntilBufferFull when one segment is sendWriteUntilBufferFull (localSocket, localSocket->GetTxAvailable()); //Put new data having the size of localSocket->GetTxAvailable() to TCP
void WriteUntilBufferFull (Ptr<Socket> localSocket, uint32_t txAvailable) {
//split 'buffer'
//...localSocket->Send (...) ;}
localSocket->GetTxAvailable() --> Socket->GetTxAvailable()
localSocket->GetTxAvailable() --> Socket->GetTxAvailable()
--
Posting to this group should follow these guidelines https://www.nsnam.org/wiki/Ns-3-users-guidelines-for-posting
---
You received this message because you are subscribed to the Google Groups "ns-3-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ns-3-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ns-3-users/c038a77f-bf82-4184-b78b-b4e6751b0ca7%40googlegroups.com.
if (all data is sent) { localSocket->Close ();}
--
Posting to this group should follow these guidelines https://www.nsnam.org/wiki/Ns-3-users-guidelines-for-posting
---
You received this message because you are subscribed to the Google Groups "ns-3-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ns-3-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ns-3-users/c4eca703-4fb3-40b3-a7d0-bd6ad78296e6%40googlegroups.com.
if (error < 0)
--
Posting to this group should follow these guidelines https://www.nsnam.org/wiki/Ns-3-users-guidelines-for-posting
---
You received this message because you are subscribed to the Google Groups "ns-3-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ns-3-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ns-3-users/949fcece-6001-4886-959d-8270c537d77d%40googlegroups.com.
if error <0, I suppose socket->SentSendCallBack(..) will call back WriteUntilBufferFull(..)
DynamicCast<TcpSocketBase>(Socket)->TraceConnect("Tx","",MakeCallback (SendPacketToIP,this));
DynamicCast<TcpSocketBase>(Socket)->TraceConnect("Rx","",MakeCallback (ReceivePacketFromIP,this));
void SendPacketToIP(std::string context, Ptr<const Packet> p, const TcpHeader& h, Ptr<const TcpSocketBase> s){ ...}
void ReceivePacketFromIP (std::string context, Ptr<const Packet> p, const TcpHeader& h, Ptr<const TcpSocketBase> s){ ...}
If your purpose is only to focus on trying to send data, this solution is fine.
But a large TCP sending buffer size (SndBufSz) is not practical.
With your settings (SndBufSz > data size), the Sending function is actually called only one time. At other times, it is no data to send.
In your previous version, your application maybe not wait for the TCP (Sending buffer) ready; and thus cause the data loss.
Best,