Setting Attributes for Two Different TCP Flows in a single Network

123 views
Skip to first unread message

Narmeen Aamir

unread,
Mar 31, 2023, 10:52:52 PM3/31/23
to ns-3-users
Hi,
I am working with a multi-node network (6 nodes) with 2 tcp flows .1st flow from nodes 0 -2-3-4 and 2nd flow from nodes 1-2-3-5. nodes 0,1 are servers and nodes 4,5 are clients.
I successfully got the two flows running but I had to set the MaxWindow size and segment size differently for the two flows. Now the problem is: these attributes belong to TcpSocketBase class and I don't know how to add them with my existing code since I am comfortable with doing like this.
I am attaching my code file. Please have a look and suggest me a way that I can set the parameters separately for the two flows.

Thank you!
part2-q2.cc

Tommaso Pecorella

unread,
Apr 2, 2023, 5:02:18 AM4/2/23
to ns-3-users
Hi,

this is a very good question, and not an easy one too. The problem is that you can't change a socket's attribute before it is created, and you want to change it before it is used too. Moreover, sockets are created at run-time, and (usually) as soon as they're created they do start connecting, and when they do it it's too late to change MaxWindowSize.

The ConfigStore can save your day, as it can both dump all the attributes (not just the default ones) into a file, and read from it too.

The. process is: add ConfigStore to your script and dump all the attributes to a file. Find the attributes you want to change (look at ids of the nodes and the sockets), then change them. Load back the config to your script and run it.
Alternatively, you can use Config::Set((char*)path, StringValue((char*)value));, but you'll need to find the right path pointing at the sockets, and the easiest way is though ConfigStore

Narmeen Aamir

unread,
Apr 3, 2023, 8:25:29 AM4/3/23
to ns-3-...@googlegroups.com
Hi,
Thank you so much for the reply. Since I am new to ns3, I really don't know about this configStore.
Can you tell me how to dump the attributes in the file you mentioned. What file type would it be? and what code do I write to dump the attributes? The nodes can be specified since I know them but how do I specify the sockets?

Please guide me through this and I'll be very grateful to you for your time and help.

Thanks in advance.

Best regards,
Narmeen Aamir

--
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/a2f8e6dd-3962-448a-ae8e-1aca55ef5588n%40googlegroups.com.

Tommaso Pecorella

unread,
Apr 3, 2023, 8:36:12 AM4/3/23
to ns-3-users
Check "src/config-store/examples/config-store-save.cc" and https://www.nsnam.org/docs/manual/html/attributes.html#configstore

Narmeen Aamir

unread,
Apr 5, 2023, 12:52:29 PM4/5/23
to ns-3-...@googlegroups.com
Thank you so much!
Let me get back to you after resolving this.
I hope I get it done this time.

Best,
Narmeen

Narmeen Aamir

unread,
Apr 10, 2023, 2:41:05 PM4/10/23
to ns-3-...@googlegroups.com
Hi ,
I read about the config store and how to implement it . While I was reading about it I found one interesting thing.
Config Set.
So i tried the config set like below and apparently, my results are fine. However, I am not actually sure that it DID set 2 different MaxWindowSize i.e. for two different flows.

This is what I wrote for 2 nodes . node 4 is the receiver node for flow 1 and node 5 is the receiver node for flow 2:

//setting the advertised window size of receiver to 30 for flow 1 and 6 packets for flow 2
  Config::Set("/NodeList/4/DeviceList/0/TcpSocketBase/MaxWindowSize", UintegerValue(30*1448));
  Config::Set("/NodeList/5/DeviceList/0/TcpSocketBase/MaxWindowSize", UintegerValue(6*1448));

Any guidance in this regard would be appreciated.

Thank you.

best regards,
Narmeen Aamir

Tommaso Pecorella

unread,
Apr 10, 2023, 6:29:52 PM4/10/23
to ns-3-users
Hi,
to be sure you could put some logs in the relevant places and see what is the window size once the flows are started.

Reply all
Reply to author
Forward
0 new messages