Bugzilla – Bug 2963
TcpSocketBase::SetAttribute("MaxWindowSize")
Last modified: 2018-07-26 16:37:15 UTC
I would like to set the maximum window size to 4MB. When I use the call SetAttribute("MaxWindowSize", 4*1024*1024), I got the following error msg. msg="Attribute name=MaxWindowSize could not be set for this object: tid=ns3::TcpSocketBase", file=../src/core/model/object-base.cc, line=201 terminate called without an active exception I also look at WinScale (if I may limit the scale to achieve the same purpose of 4MB max window). But I did not find applicable API. As long as there is a reasonable way to limit the window size to 4MB, I am fine with the solution.
Try: socket->SetAttribute ("RcvBufSize", UintegerValue (4000000)); The MaxWindowSize is limited to 16 bits (maximum size of 65535) which is why you got that error. I am not sure whether it is meaningful to set MaxWindowSize when window scale is being used. I would leave it alone and just manage the RX buffer size.
Please confirm: If I set the Tcp RX buffer size to 4MB, I can have the same effect of limiting the max window size to 4MB?
(In reply to Chih-Yuan Chang from comment #2) > Please confirm: If I set the Tcp RX buffer size to 4MB, I can have the same > effect of limiting the max window size to 4MB? The advertised window is limited by the size of the receive buffer. The advertised window is set in this method: http://code.nsnam.org/ns-3-dev/file/f868c87528b1/src/internet/model/tcp-socket-base.cc#l3188 The specific line is: w = static_cast<uint32_t> (m_rxBuffer->MaxRxSequence () - m_rxBuffer->NextRxSequence ()); and the difference in sequence number is constrained by the Rx buffer size. The remainder of the method deals with window scale and limiting the post-scaled version to the MaxWindowSize attribute. If you want to monitor the window size, you can either enable PCAP tracing or else use the ns-3 trace source AdvWND directly: http://code.nsnam.org/ns-3-dev/file/f868c87528b1/src/internet/model/tcp-socket-base.cc#l177