How to set SegmentSize

1,163 views
Skip to first unread message

C Facchini

unread,
Sep 18, 2009, 10:13:53 AM9/18/09
to ns-3-users
Dear list,

I am trying to modify the value of the SegmentSize (defined as an
attribute in src/node/tcp-socket.cc), by default 536 bytes.

What I'm doing is:
// getting the MTU value
uint16_t Mtu = wifiDevices.Get (0)->GetMtu ();
// setting MSS to MTU-40 for all nodes
Config::Set ("/NodeList/*/$ns3::TcpL4Protocol/SocketList/*/
SegmentSize", UintegerValue (Mtu-40))

This however doesn't seem to work.

Observations.
1) The path *should be* right; as a matter of fact, if I set the
Attribute *after* the application starts:
Simulator::Schedule (Seconds (1.5), Config::Set, "/NodeList/*/
$ns3::TcpL4Protocol/SocketList/*/SegmentSize", UintegerValue
(Mtu-40));
I get this error:
file=../src/internet-stack/tcp-socket-impl.cc, line=1670, abort on="!
(m_state == CLOSED)", msg="TcpSocketImpl::SetSegSize(): Cannot change
segment size dynamically."
which I think it means I reached the variable somehow.
I'm not sure why both the TraceSource 'CongestionWindow' and the
Attribute 'SegmentSize' can be reached by means of the same path
(though they belong to different objects: TcpSocketImpl and TcpSocket,
respectively).
2) ConfigStore shows a different path. The relative entry reads:
default ns3::TcpSocket::SegmentSize "536"
Still, I didn't succeed in finding a path containing /$ns3::TcpSocket/
that did the trick.

Regards,
Christian

C Facchini

unread,
Sep 22, 2009, 4:54:22 PM9/22/09
to ns-3-users
I've run some tests, and I think it's good to update the post.

The following procedure is not the correct one.
>   // getting the MTU value
>   uint16_t Mtu = wifiDevices.Get (0)->GetMtu ();
>   // setting MSS to MTU-40 for all nodes
>   Config::Set ("/NodeList/*/$ns3::TcpL4Protocol/SocketList/*/
> SegmentSize", UintegerValue (Mtu-40))

As stated in bug #579 (http://www.nsnam.org/bugzilla/show_bug.cgi?
id=579), to change the segment size you can:
a) either pass it as a command line parameter: --
ns3::TcpSocket::SegmentSize=1460
b) or set it by means of SetDefault: Config::SetDefault
("ns3::TcpSocket::SegmentSize", UintegerValue (1460));

> 1) The path *should be* right; as a matter of fact, if I set the
> Attribute *after* the application starts:
>   Simulator::Schedule (Seconds (1.5), Config::Set, "/NodeList/*/
> $ns3::TcpL4Protocol/SocketList/*/SegmentSize", UintegerValue
> (Mtu-40));
> I get this error:
>   file=../src/internet-stack/tcp-socket-impl.cc, line=1670, abort on="!
> (m_state == CLOSED)", msg="TcpSocketImpl::SetSegSize(): Cannot change
> segment size dynamically."
This, quoting Craig Dowell, is to prevent users like me from "shooting
themselves in the foot" :)

Regards,
Christian
Reply all
Reply to author
Forward
0 new messages