Search This Blog

Rate Control Protocol (RCP) Patch for ns-2.35

Labels: , ,

Rate Control Protocol (RCP) is a congestion control mechanism which focuses on minimizing the flow-completion time. It is designed and developed by Nandita Dukkipati, a Ph.D Student then, at Stanford University. Following is a link to the official page of RCP:

RCP's patch for ns-2 is available on the above link for ns-2.28 and ns-2.30 versions. Since installation procedure of these ns-2 versions on present Linux flavors hinders several researchers, I developed a RCP patch for ns-2.35 which is the latest version.

Follow the steps given below to apply RCP's patch to ns-2.35:

1. Download ns-allinone-2.35.tar.gz

2. Download rcp-ns2-35.patch

3. Unzip ns-allinone-2.35.tar.gz. You will get a folder named ns-allinone-2.35

4. Paste the downloaded RCP patch in the above mentioned folder.

5. Give the following command:

patch -p1 < rcp-ns2-35.patch

6. Go in ns-allinone-2.35 via terminal and give the following command (It is always recommended to be in root mode while giving the below command):


If you already have an installed copy of ns-allinone-2.35, then follow the steps given below to apply the RCP patch:

1. Paste the downloaded RCP patch in ns-allinone-2.35 directory.

2. Give the following command:

patch -p1 < rcp-ns2-35.patch

3. Go in ns-allinone-2.35/ns-2.35 directory and give the following commands:

make clean
make install

You are done with it!

Sample TCL Scripts:
Use the sample TCL Scripts provided on the official website of RCP. Following is the link:

rcp-ns-2.30.tar.gz must be downloaded from the above link. It contains a folder named "example-tcl-files" which contains the sample TCL Scripts.

A Note on the installation of ns-allinone-2.35:
You may or may not get installation errors depending on which version of gcc is used in your OS. With Ubuntu 10.04 (gcc 4.4.3), the installation procedure did not give any error. However, with later versions of Ubuntu there are chances that you may get a few errors. If you do not find a solution for those errors, report it in the Comments section.

Hope it helps.

Mohit P. Tahiliani

Comments (38)

Your contributions to NS2 researchers is invaluable.
Thank you Mohit.
Wish you all success in your endeavors.

sir Mohit P. Tahiliani

my name is Muhammad Rizka. I am an postgraduate student from Indonesia. Currently i want to get a research about "super peer system".
could you give me example code in ns2 that talk about super peer system or super peer election.

thanks you so much..

Sir, Getting following errors....

*** buffer overflow detected ***: ns terminated
======= Backtrace: =========
and many more lines....

Please provide the solution.

Error resolved. thank you...

I was trying to run sample tcl scripts:

ns longlived.rcp.tcl

But getting following errors:

wrong # args: should be "source fileName"
while executing
"source -encoding utf-8 [file join $TclLibDir clock.tcl]"
(procedure "::tcl::clock::format" line 3)
invoked from within
"clock format [clock seconds]"
invoked from within
"puts "#Date: [clock format [clock seconds]]""
(file "longlived.rcp.tcl" line 10)

@Rizka - Sorry, so far I have not come across such a code in ns-2. However, for reference - you can try looking at the LEACH protocol code which includes an algorithm for leader selection. It might help you to get started atleast.

@Bhargavi - Your TCL Script named "longlived.rcp.tcl" is trying to call another TCL Script named "clock.tcl". Usually it is done by following command:

source filename

In your case, it must be

source clock.tcl

However, there are a few arguments as you can see on the following line:

source -encoding utf-8 [file join $TclLibDir clock.tcl]

and thats what is leading to error.

Try to find out why these arguments are used instead of simply using "source filename".

Hope it helps.

Mohit P. Tahiliani

Problem Solved. Thank You.... :)

Dear Sir,
I am a final year M.Tech-IT student. I am doing a Project in Multicast Protocols Evaluation on MANET. I have no idea in Running Multicast Protocols in NS2.35. Please help me in running MAODV and ODMRP Routing Protocols in NS2.35, Sir. Some say that i have to add patch files for those protocols, but the patch files available in Internet are only supported in NS2.26 version. I request you to help me in running those protocols, Sir. Please....

Sir i created a simple topology and assign the agents and finally i want to send packets in to send data in nsg2.1

Dear Sir,

I am Uditnarayan Kar currently working on RCP protocol and I want to implement this RCP protocol in wireless medium. Kindly guide me sir what kind of changes I have to do to make it run successfully.

Thanks And Regards

Uditnarayan Kar

I am Melina Maria Afonso , a student of Masters of Computer Science and Engineering course at the Goa College of Engineering, Goa, India.

As a part of my final year project sir, I have been interested in the QoS provisioning in wireless networks and am looking forward in doing interesting work in this field.

I have read the paper "THE EFFECTS OF MAC LAYER PARAMETERS ON QUALITY OF SERVICE PROVIDED BY 802.11E" by Daniel Fokum and wish to run the codes available in the paper.

I am also planning to use the NS2 simulator and have installed the ns-allinone-2.35 version on ubuntu 11.04. I am a beginner to this simulator. I have tried to study the codes provided However when I tried running them I have been encountering errors.

If u could help me sir I would be very grateful.

I am Jitender Grover doing M.Tech from M.M.U. Mullana.
May I know how to find balance energy and position of nodes in DSR and DSDV protocols.

Mohit i am implementing DSR malicious but i could not able to drop packets
please if you have code of malicious please help me where to make changes

While doing make in ns2.34 i get the following error..
tools/ In member function ‘virtual int RNG::command(int, const char* const*)’:
tools/ error: ‘RNGTest’ was not declared in this scope
tools/ error: expected ‘;’ before ‘test’
tools/ error: ‘test’ was not declared in this scope
make: *** [tools/rng.o] Error 1

please help..

I need to download patches for split TCP and ATCP for NS2.34
Could You plzzz help me out.....

Dear Sir
I am ME Research Scholar and working on routing protocols for WSN. Please help me regarding the simulation codes of routing protocols.

Note for Readers: The answers to the above questions are given quite late. Hope it helps other readers who have similar queries.

@Mohan - Yes it is true. There are no patches for MAODV and ODMRP for higher versions of ns-2. You need to manually apply those patches if you want to work with them in the higher versions of ns-2.

@Narasimha - We cannot send data in NSG 2.1. It can be used only to generate the TCL Scripts. The generated TCL Script can be then executed in ns-2.

@Uditnarayan - It is little tricky process. You need to make changes on both the sides: hosts as well as network elements. While the changes at the host sides are few, there may be many changes required in the network elements part.

@Melina - The best way to start executing wireless codes in ns-2 is to run the sample codes provided in the default all-in-one package of ns-2. The sample scripts are available in the following directory:


@Jitendra - The process is similar to the one shown on the following link:

@Sakshi - You need to use the built-in function named "drop" which generally takes two arguments: packet which is to be dropped and the reason for the packet drop. See the following link for reference:

@Vivek - You need to go in rng.h and declare RNGTest there.

@Avinka - The patches for those protocols are available only for lower versions of ns-2. They are not available for ns-2.34

@Simranjeet - Patches for few of the WSN routing protocols like LEACH, SPIN, etc are available. You may try working with those initially.

Hope it helps.

Mohit P. Tahiliani

hi sir,
i am working on maodv protocol in ns2.35, it successfully installed and tcl script running fine, on running tcl script i have got trace file of size 456 mb (somthing) and nam file of size 85 mb, but the problem istha their no graphs are generating. so please sir give me solution for that ASAP.
thank you.

I am working in multicast routing i manet.In ns2.35, how can I add maodv and odmrp protocols which are not available in ns2.35. Please help me.

@Akash - You need to use either AWK or PERL to extract the necessary information from those trace files to plot graphs. Some of the AWK Scripts are available in this blog.

@Gayathri - As of now patches for MAODV and ODMRP are not available for ns-2.35 version. You may try to manually apply the patch using line by line comparisons.

Hope it helps.

Mohit P. Tahiliani

Thank you for your reply. I tried to apply MAODV patch by manually adding extra lines in common files for multicasting. I got "No compatible data type " error.

Hello Sir ,

I am a student .I am working on SPIN protocol in Wireless sensor networks.I have the code for SPIN protocol available at!msg/ns-3-users/z1pzF82-QGo/gsoYS-qi834J.
Please help me out sir, that how to add SPIN protocol in ns2.34 using ubuntu 12.04.

if you could help me sir..i shall be very thankful !!

Sir I am getting few errors related to the paper Reliable Anchor -based sensor Localization in Irregular Areas.1.According to Animation Packet delivery is not proper
2.Which anchors are reliable are not displayed on terminal or NAM Window.
3.Packets are crossing directly through Obstacle which should not be so.
Density of node is not displayed .
so sir pls help in this matter to resolve this error.
I am using concept conseedering density of nodes

I add new protocol in ns-2 name "binary marking congestion protocol(bmcc )"

i am using fedora 12 and using ns-allinone-2.33,when i run 'make' command in terminal it give me this error,[hdr_nv::access(Packet*)]+0x7): undefined reference to `hdr_nv:ffset_'
apps/worm.o.rodata._ZTV9AnWormApp[vtable for AnWormApp]+0x28): undefined reference to `Process::get_data(int&, AppData*)'
apps/worm.o.rodata._ZTV10DnhWormApp[vtable for DnhWormApp]+0x28): undefined reference to `Process::get_data(int&, AppData*)'
apps/worm.o.rodata._ZTV7WormApp[vtable for WormApp]+0x28): undefined reference to `Process::get_data(int&, AppData*)'
collect2: ld returned 1 exit status
make: *** [ns] Error 1

how i can solve this error?

helllo sir...
how to calculate bandidth in ns2?? is der any awk script???

sir,can you suggest me which protocol patch can i use for " we can deliver messages to far vehicles" in NS2

Hello Sir,
Can you help me for installation of MAODV in NS 2.33? I am getting error during it.

Hello sir ,
I want to know that is it possible to implement cryptography algorithm in leach. I am a beginner so plz help me. can i find source for them ?

can you please tell me about from where i can get ODMRP simulation code in ns2

Is it possible to install ns 2.26 on ubuntu 11.10? I want to install available patch of MAODV for NS 2.26.

@Kinjal - Yes, it is possible but you might have go through a lot of GCC errors!

@Menaka - See if you can download from here:

@Arpita - Yes, it is possible to implement cryptographic algorithms in ns-2 with leach but there is no ready source for that!

Hope it helps.

Mohit P. Tahiliani

Hi Mohit!

Thanks for this work, it looks really good and has been helpful! I have been trying to replicate the tests and have been getting errors with the test files. Were you able to get successful test runs with the given files from the RCP site?

XCP tests through command not found errors on the agents and if changing to similar ones already in ns TCP/XCP -> TCP/Reno/XCP and XCPSink -> TCPSink/XCPSink then there are still errors that the packet sizes are <= 0.

Have you had similar results or maybe some insight on how to fix this.


@Mango - I did try to run the test files for RCP but that was to ensure that the patch works correctly!

After that, I haven't worked on it much.

However, I know a few people who are working on it right now. I shall ask them and get back to you.

Mohit P. Tahiliani

anyone have rcp patch for NS 2.35 in wireless scenario? i have rcp patch for wired scenario. can any one tell me what modifications i have to done in tcl file to run this patch for wireless environment?

@Ishani - RCP patch remains same for wired as well as wireless networks. It just like TCP - the implementation remains same.

So there is no need to look for RCP's wireless patch. Try using this patch itself, but in a wireless TCL script.

Hope it helps.

Mohit P. Tahiliani

Your work is great in this field...

Plzzz Give me the tcl file for this as example. as early as possible

plzzzzzzzz reply me as early as possible

@Sabir - Sample TCL file is available in the patch itself.

Try installing the patch.

Hope it helps.

Mohit P. Tahiliani