How to use Tcp Variants Comparison in NS3?

試著忘記壹切 提交于 2020-02-01 08:41:09

问题


I need to compare different type of TCP using ns-3 for a class project. I am new with ns-3. I don't want to implement a new code. Briefly, I have 2 questions:

  1. Which example of ns-3 is the best for my purpose? Tcp-Variants-Comparison.cc?
  2. How can I see the output. I ran the code, but there was no output.

回答1:


You can run your example using .waf. Navigate to your ns-3 directory (the place where .waf executable is located) and run:

./waf --run tcp-variants-comparison

This will compile (if needed) and run the example with default arguments. You can change arguments using --command-template="%s <args>". If you look inside the tcp-variants-comparison.cc you can see all available arguments, e.g.:

...
cmd.AddValue ("delay", "Access link delay", access_delay);
cmd.AddValue ("tracing", "Flag to enable/disable tracing", tracing);
cmd.AddValue ("tr_name", "Name of output trace file", tr_file_name);
cmd.AddValue ("cwnd_tr_name", "Name of output trace file", cwnd_tr_file_name);
...

So here is an example how you can store congestion window of default TcpWestwood protocol to cwndTrace file:

./waf --run tcp-variants-comparison --command-template="%s --tracing=1 --cwnd_tr_name=cwndTrace"

You can then use any tool you like to display the data. Here is how to plot it with gnuplot:

$ gnuplot
gnuplot> set terminal png size 640,480
gnuplot> set output "cwnd.png"
gnuplot> plot "cwndTrace" using 1:2 title 'Congestion Window' with linespoints
gnuplot> exit

You should also take a look at this NS-3 tutorial. This gives you a pretty good introduction to NS-3, so read it carefully.

So to answer your question completely, you can use this example for comparison of:

cmd.AddValue ("transport_prot", "Transport protocol to use: TcpTahoe, TcpReno, TcpNewReno, TcpWestwood, TcpWestwoodPlus ", transport_prot);

So run this example with different transport_prot arguments and compare your traces.



来源:https://stackoverflow.com/questions/36963678/how-to-use-tcp-variants-comparison-in-ns3

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!