Hi every body
I have a problem that is so urgent for me. can anybody helps me?

I'm using NS 2.27. I want to run a CBR application from my .c code. So I add 
these lines of code to my agent code:

********************************************************************************
      Tcl& tcl = Tcl::instance();

      char * Name;

///  UDP Source 
      Name=const_cast<char *>(name());
      sprintf(tcl.buffer(), "%s set sourcenode_id", Name);
      tcl.eval();

      assert(*tcl.result());
      int sourcenode_id = atoi(tcl.result());

      tcl.eval("set udp1 [new Agent/UDP]");
      tcl.eval("$udp1 set class_ 2");
      tcl.eval("set null [new Agent/Null]");

      sprintf(tcl.buffer(), "Simulator attach-agent %s $udp1", Source);
      tcl.eval();        

      char *rslt=const_cast<char *>(tcl.result());          

/// UDP Sink 

      Name=const_cast<char *>(name());
      sprintf(tcl.buffer(), "%s set destnode_id", Name);
      tcl.eval();

      assert(*tcl.result());
      int destnode_id = atoi(tcl.result());

      tcl.eval("set udp1 [new Agent/UDP]");
      tcl.eval("$udp1 set class_ 2");
      tcl.eval("set null [new Agent/Null]");

      sprintf(tcl.buffer(), "Simulator attach-agent %s $null", Destination);
      tcl.eval();       

      rslt=const_cast<char *>(tcl.result());           //      tcl.result(rslt);
      cout << "Destination set by FA : " << rslt <<"\n";

///  CBR App.   
      tcl.eval("Simulator connect $udp1 $null");
      tcl.eval("set cbr1 [new Application/Traffic/CBR]");
      tcl.eval("$cbr1 attach-agent $udp1");
      tcl.eval("$cbr1 set PacketSize_ 1000");
      tcl.eval("$cbr1 set rate_ 0.01Mb");
      tcl.eval("Simulator at-now \"$cbr1 start\" ");

      cout << "  CBR Application Starts   \n";


************************************************************************

when I make my ns2 and run my tcl code, I see the line "CBR Application Starts 
" but the trace file is empty!!!

I added a trace file to my .c code, too and flush-trace to it, but I still have 
an empty trace file!!!!!!
please help me. I have so little time to solve my problem.
with thanks: Fahimeh

Reply via email to