[英]NS3: how to setup RcvBufSize for each TCP session?
I have to run two TCP sessions with different RcvBufSize. 我必须使用不同的RcvBufSize运行两个TCP会话。
I know the following code can setup the RcvBufSize for all TCP sessions. 我知道以下代码可以为所有TCP会话设置RcvBufSize。
Config::SetDefault("ns3::TcpSocket::RcvBufSize", UintegerValue (1500000));
Actually, I'm looking for the function like setsockopt()
to setup SO_RCVBUF for each TCP session. 实际上,我正在寻找像setsockopt()
这样的函数来为每个TCP会话设置SO_RCVBUF。
I also tried to downcast Ptr<Socket>
to Ptr<TcpSocket>
, but SetRcvBufSize()
is private function... 我也尝试将Ptr<Socket>
向下转换为Ptr<TcpSocket>
,但SetRcvBufSize()
是私有函数...
Is there anyway to solve this problem? 反正有没有解决这个问题?
I changed SndBufSize
in my application using SetAttribute
call. 我使用SetAttribute
调用在我的应用程序中更改了SndBufSize
。 I have a class with the socket pointer member ns3::Ptr<ns3::Socket> m_pSocket
and to change the send buffer size I do this: 我有一个类与套接字指针成员ns3::Ptr<ns3::Socket> m_pSocket
并更改发送缓冲区大小我这样做:
// create tcp socket
m_pSocket = ns3::Socket::CreateSocket( GetNode(), ns3::TcpSocketFactory::GetTypeId() );
m_pSocket->SetAttribute("SndBufSize", ns3::UintegerValue(4096000));
So in your case you have to call: 所以在你的情况下你必须打电话:
yourSocket->SetAttribute("RcvBufSize", ns3::UintegerValue(1500000));
This way you can set every attribute of ns3::TcpSocket . 这样就可以设置ns3 :: TcpSocket的每个属性。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.