[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[ns] patch: Agent send filesize



Hi,

this didn't work:

   set rngFtpNorm [new RandomVariable/Normal];
   $rngFtpNorm set avg_ 5000000
   $rngFtpNorm set std_ 2500000

   set ftp($j) [new Application/FTP]
   set ftpFileSize [$rngFtpNorm value];
   $ns_ at 10.0 "$ftp($j) send $ftpFileSize"

$rngFtpNorm value returned values like "3.612e+006", this wasn't correctly converted to 3612000, but only to 3.
The following patch fixes this.

agent.cc

int Agent::command(...) 
{
...

         } else if (strcmp(argv[1], "send") == 0) {
-            sendmsg(atoi(argv[2]));
+            sendmsg(int(atof(argv[2])));
            return (TCL_OK);
         } else if (strcmp(argv[1], "set_pkttype") == 0) {
            set_pkttype(packet_t(atoi(argv[2])));
            return (TCL_OK);
         }
      }
      else if (argc == 4) {	
         if (strcmp(argv[1], "sendmsg") == 0) {
-           sendmsg(atoi(argv[2]), argv[3]);
+            sendmsg(int(atof(argv[2]), argv[3]));
            return (TCL_OK);
         }
      }
      else if (argc == 5) {
         if (strcmp(argv[1], "sendto") == 0) {
-            sendto(atoi(argv[2]), argv[3], (nsaddr_t)atoi(argv[4]));
+            sendto(int(atof(argv[2])), argv[3], (nsaddr_t)atoi(argv[4]));
            return (TCL_OK);

...
};


Bye
Alex

--
Free Dmitry Sklyarov ! 
http://www.freesklyarov.org