[ns] please help!!!

2012-10-03 Thread Najma Ismat


hi,i have simulated LEACH protocol for 10 nodes in ns-2. 29 with mannasim and 
observe that the trace file show nodes greater than 10 with tag -Hd when 
packets are received. i have  marked the portion of trace with error in red. 
please guide why i getting this and how to resolve this issue? 
regards,najma

s -t 0.086012595 -Hs 4 -Hd -2 -Ni 4 -Nx 99.83 -Ny 22.79 -Nz 0.00 -Ne 10.00 
-Nl AGT -Nw --- -Ma 0 -Md 400 -Ms 0 -Mt 0$r -t 0.086012595 -Hs 4 -Hd -2 -Ni 
4 -Nx 99.83 -Ny 22.79 -Nz 0.00 -Ne 10.00 -Nl RTR -Nw --- -M a 0 -Md 400 
-Ms 0 -Mt 0$s -t 0.086012595 -Hs 4 -Hd -2 -Ni 4 -Nx 99.83 -Ny 22.79 -Nz 0.00 
-Ne 10.00 -Nl RTR -Nw --- -Ma 0 -Md 400 -Ms 0 -Mt 0$s -t 0.086037595 
-Hs 4 -Hd -2 -Ni 4 -Nx 99.83 -Ny 22.79 -Nz 0.00 -Ne 10.00 -Nl MAC -Nw --- 
-Ma 0 -Md 400 -Ms 000$N -t 0.086038 -n 8 -e 9.98N -t 0.086038 -n 9 
-e 9.98N -t 0.086038 -n 10 -e 9.98N -t 0.086038 -n 2 -e 9.98N -t 
0.086038 -n 3 -e 9.98N -t 0.086038 -n 0 -e 99.52N -t 0.086038 -n 5 -e 
9.98N -t 0.086038 -n 1 -e 9.98N -t 0.086038 -n 7 -e 9.98N -t 
0.086038 -n 6 -e 9.98r -t 0.086133679 -Hs 8 -Hd 26 -Ni 8 -Nx 89.50 -Ny 
45.73 -Nz 0.00 -Ne 9.98 -Nl MAC -Nw --- -Ma 0 -Md 400 -Ms 0008$r -t 
0.086133779 -Hs 9 -Hd 56 -Ni 9 -Nx 70.26 -Ny 69.47 -Nz 0!
 .00 -Ne 9.98 -Nl MAC -Nw --- -Ma 0 -Md 400 -Ms 0008$r -t 
0.086133807 -Hs 10 -Hd 64 -Ni 10 -Nx 69.96 -Ny 78.95 -Nz 0.00 -Ne 9.98 -Nl 
MAC -Nw --- -Ma 0 -Md 400 -Ms 00$r -t 0.086133810 -Hs 2 -Hd 65 -Ni 2 
-Nx 36.50 -Ny 11.07 -Nz 0.00 -Ne 9.98 -Nl MAC -Nw --- -Ma 0 -Md 400 -Ms 
0008$r -t 0.086133814 -Hs 3 -Hd 66 -Ni 3 -Nx 39.10 -Ny 47.74 -Nz 0.00 -Ne 
9.98 -Nl MAC -Nw --- -Ma 0 -Md 400 -Ms 0008$r -t 0.086133817 -Hs 0 
-Hd 67 -Ni 0 -Nx 38.67 -Ny 49.48 -Nz 0.00 -Ne 99.52 -Nl MAC -Nw --- -Ma 0 
-Md 400 -Ms 000$r -t 0.086133843 -Hs 5 -Hd 75 -Ni 5 -Nx 96.38 -Ny 97.11 
-Nz 0.00 -Ne 9.98 -Nl MAC -Nw --- -Ma 0 -Md 400 -Ms 0008$r -t 
0.086133882 -Hs 1 -Hd 87 -Ni 1 -Nx 43.65 -Ny 87.99 -Nz 0.00 -Ne 9.98 -Nl 
MAC -Nw --- -Ma 0 -Md 400 -Ms 0008$ 
  


[ns] using Pcap/BPF Network Objects

2012-10-03 Thread חגית מריומה

Hello All,

I tried to use the configuration example for using Network/Pcap Objects,
but ran into an error.
http://www.cubinlab.ee.unimelb.edu.au/~jrid/Docs/Manuel-NS2/node484.html

Anyone knows this error and how to solve it? it says that the simulator
doesn't recognize the command.

*Here is the code example:*

set me [exec hostname]
 *set pf1 [new Network/Pcap/Live]*   this is the line that throws
the error
 $pf1 set promisc_ true
 set intf [$pf1 open readonly]
 puts pf1 configured on interface $intf
 set filt (ip src host foobar) and (not ether broadcast)
 set nbytes [$pf1 filter $filt]
 puts filter compiled to $nbytes bytes
 puts drops: [$pf1 pdrops], pkts: [$pf1 pkts]


*Here is the error:*

invalid command name Network/Pcap/Live
while executing
Network/Pcap/Live create _o3 
invoked from within
catch $className create $o $args msg
invoked from within
if [catch $className create $o $args msg] {
if [string match __FAILED_SHADOW_OBJECT_ $msg] {
delete $o
return 
}
global errorInfo
error class $...
(procedure new line 3)
invoked from within
new Network/Pcap/Live
invoked from within
set pf1 [new Network/Pcap/Live]
(file rt1.tcl line 2)


















 On Tue, Oct 2, 2012 at 10:22 AM, חגית מריומה hagit.mary...@gmail.comwrote:





 תחילת ההודעה שהועברה:

 *מאת:* saleem khan star_s...@yahoo.com
 *תאריך:* 28 בספטמבר 2012 11:07:27 GMT+02:00
 *אל:* חגית מריומה hagit.mary...@gmail.com
 *נושא:* *בעניין: [ns] Text input files with ns2*
 *השב לכתובת:* saleem khan star_s...@yahoo.com

 You can do it by using command cbr gen means cbr traffic generation which
 writes its results to a text file then load this text file in TCL file.
 search for CBR GEN command


 *Muhammad Saleem Khan*
 *Ph.D(CS) , COMSATS Institute of Information Technology, Islamabad.*
 *Cell No# 0346-9754454*

   --
 *From:* חגית מריומה hagit.mary...@gmail.com
 *To:* Dejene B. djz...@gmail.com
 *Cc:* ns-users@ISI.EDU ns-users@ISI.EDU
 *Sent:* Friday, September 28, 2012 2:12 AM
 *Subject:* [ns] Text input files with ns2



 Anyone can help how to load text input files into ns2 instead of using
 tcp/udp source through ns2?
 If so, any text format? Or a simple example?

 Thanks!


 ב-27 בספט 2012, בשעה 06:40, Dejene B. djz...@gmail.com כתב/ה:

 
  hi all,
 
  what is maximum Tcp paload size (application demand) in ns-2. I am
  observing a strange behavior when I set to 1MB and larger. The packets
  don't reach the intended destination. However, some documentations say
 it
  can be infinite.
 
  thanks,
 
  --
  *Dejene Boru*
  *.
  *
  Graduate Student-Telecom Eng
  University of Trento
  Via  Brennero 150
  Trento, Italy
  dejeneboru.oljir...@unitn.it
  djz...@gmail.com
  0039-388-998-1919
 
  *
  *






[ns] Schedule an event

2012-10-03 Thread Rafael P B Mota

Hello,

I am trying to use a random delay (in receiver) before the packet is sent
back to the sender agent. For example:

1) the receiver agent receive the sender packet
2) the receiver sets up a response packet
3) Wait for a random time (in ms)
4) sends the packet.

I don't know how to do the step 3.

I am pasting the code bellow: Somebody can help me ?

void MyAgent::recv(Packet* pkt, Handler*)
{
  hdr_ip* hdrip = hdr_ip::access(pkt);
  hdr_rfidPacket* hdr = hdr_rfidPacket::access(pkt);
  if (hdr-tipo_==1) {
  Packet* pktret = allocpkt();
hdr_rfidPacket* hdrTag = hdr_rfidPacket::access(pktret);
hdr_ip* hdrIp = hdr_ip::access(pktret);
hdrTag-tagEPC_ = tagEPC_;
  hdrTag-id_ = hdr-id_;
hdrTag-tipo_ = 0;
hdrIp-daddr() = IP_BROADCAST;
hdrIp-dport() = hdrip-sport();

send(pktret,0);
  }
  else {
Packet::free(pkt);
  }
  Packet::free(pkt);
  return;
}

-- 

Rafael Perazzo B Mota
r pera...@ime.usp.brafaelpera...@gmail.com
Web-page: https://sites.google.com/site/rafaelperazzo/
Doutorando em Ciência da Computação
Universidade de São Paulo (USP)
Campus da Capital
Instituto de Matemática e estatística (IME)
--


[ns] Random time to send a packet

2012-10-03 Thread Rafael P B Mota

Hello,

I am trying to use a random delay (in receiver) before the packet is sent
back to the sender agent. For example:

1) the receiver agent receive the sender packet
2) the receiver sets up a response packet
3) Wait for a random time (in ms)
4) sends the packet.

I don't know how to do the step 3.

I am pasting the code bellow: Somebody can help me ?

void MyAgent::recv(Packet* pkt, Handler*)
{
  hdr_ip* hdrip = hdr_ip::access(pkt);
  hdr_rfidPacket* hdr = hdr_rfidPacket::access(pkt);
  if (hdr-tipo_==1) {
  Packet* pktret = allocpkt();
 hdr_rfidPacket* hdrTag = hdr_rfidPacket::access(pktret);
 hdr_ip* hdrIp = hdr_ip::access(pktret);
 hdrTag-tagEPC_ = tagEPC_;
  hdrTag-id_ = hdr-id_;
 hdrTag-tipo_ = 0;
 hdrIp-daddr() = IP_BROADCAST;
 hdrIp-dport() = hdrip-sport();
 *//HOWTO WAIT A RANDOM TIME (in miliseconds) before send back the
packet ??*
  send(pktret,0);
  }
  else {
Packet::free(pkt);
  }
  Packet::free(pkt);
  return;
}

-- 

Rafael Perazzo B Mota
r pera...@ime.usp.brafaelpera...@gmail.com
Web-page: https://sites.google.com/site/rafaelperazzo/
Doutorando em Ciência da Computação
Universidade de São Paulo (USP)
Campus da Capital
Instituto de Matemática e estatística (IME)
--


Re: [ns] Random time to send a packet

2012-10-03 Thread Rafael P B Mota

Thanks for the response Christos!!

I tried the while solution with no success. Is there any way to wait, for
instance, 100ms, before the command send(pktret,0) is executed ? I guess
it's a simple issue, but until now I was not able to solve.

Does anyone can suggest something to do ?

Thanks all!!


2012/10/3 Christos Spatiotis spati...@ceid.upatras.gr

 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1

 Hello , Rafael

 If you try to put send(pktret,0) in a while which run for a random
 time. I guess i do not know.
 Please let me know if you make it.

 On 10/03/2012 05:37 PM, Rafael P B Mota wrote:
 
  Hello,
 
  I am trying to use a random delay (in receiver) before the packet
  is sent back to the sender agent. For example:
 
  1) the receiver agent receive the sender packet 2) the receiver
  sets up a response packet 3) Wait for a random time (in ms) 4)
  sends the packet.
 
  I don't know how to do the step 3.
 
  I am pasting the code bellow: Somebody can help me ?
 
  void MyAgent::recv(Packet* pkt, Handler*) { hdr_ip* hdrip =
  hdr_ip::access(pkt); hdr_rfidPacket* hdr =
  hdr_rfidPacket::access(pkt); if (hdr-tipo_==1) { Packet* pktret =
  allocpkt(); hdr_rfidPacket* hdrTag =
  hdr_rfidPacket::access(pktret); hdr_ip* hdrIp =
  hdr_ip::access(pktret); hdrTag-tagEPC_ = tagEPC_; hdrTag-id_ =
  hdr-id_; hdrTag-tipo_ = 0; hdrIp-daddr() = IP_BROADCAST;
  hdrIp-dport() = hdrip-sport(); *//HOWTO WAIT A RANDOM TIME (in
  miliseconds) before send back the packet ??* send(pktret,0); } else
  { Packet::free(pkt); } Packet::free(pkt); return; }
 


 - --
 ===
 Undergraduate student Spatiotis Christos
 Department of Computer Engineering  Informatics (CEID)
 University of Patras, Greece
 e-mail: spati...@ceid.upatras.gr
 website: http://spatiotis.wordpress.com
 
 -BEGIN PGP SIGNATURE-
 Version: GnuPG v1.4.12 (GNU/Linux)
 Comment: Using GnuPG with Mozilla - http://www.enigmail.net/

 iQEcBAEBAgAGBQJQbE/YAAoJEC9xXqfymW+O/uQIAIxGwtzvq/DuK9v/A2pkqm0g
 sAvwTQeoyA+w2psIVdAObud+mhuYh1GMTIBHlTEmCOt/8nSCUVnswqQlbONAOx7Y
 HecsOmhcTeDbRh1ncXqNc3iw4DKtGwS2RaiFYolfjV6pXSKz/EM0YDR29p4uZv5K
 eRAEW5TIGTTy3dYWzUf2+dexz9AiA5+UHBpP+AT9EgoTCv2u2DTyiUt3ysDl4zTd
 HgKKwZ8iBNXO0H35Eqf2ri6R6adYVtERKpSNk5fW5fxMkQuqR18szzEYcNPrfgbQ
 MjaQQmBHy7iFFbC/Hu2nVPPmL3d6o8Qn66IvX/Ap6Yy6Kwa/a/PRZOyoFV5q2U8=
 =riL2
 -END PGP SIGNATURE-




-- 

Rafael Perazzo B Mota
r pera...@ime.usp.brafaelpera...@gmail.com
Web-page: https://sites.google.com/site/rafaelperazzo/
Doutorando em Ciência da Computação
Universidade de São Paulo (USP)
Campus da Capital
Instituto de Matemática e estatística (IME)
--


Re: [ns] Random time to send a packet

2012-10-03 Thread Rafael P B Mota

Hello Natalya,

I tryed the solution:

  srand(time(NULL));
  int tempo = rand() % 400 + 100;
  Scheduler sch = Scheduler::instance();
  sch.schedule(target_,pktret,tempo);
  //send(pktret,0);

But the packet is not sent.
If I uncomment the line send(pktret,0) I get an error like this: Scheduler:
Event UID not valid!

What should I do ?

2012/10/3 Natalya Rozhnova rojnovanatha...@yandex.ru

 Hi,

 There are two ways to do it. Try this way for example:

 Scheduler sch = Scheduler::instance();
 sch.schedule(target_, [packet you want to send], [delay in ms]);

 The second way I don't remember exactly but it consists in using the
 function reschedule. You can read about these functions in detail in ns2
 manual.

 Hope it helps you,
 --
 Cordialement,
 Natalya Rozhnova

 03.10.2012, 21:44, Rafael P B Mota rafaelpera...@gmail.com:

 Hello,

 I am trying to use a random delay (in receiver) before the packet is sent
 back to the sender agent. For example:

 1) the receiver agent receive the sender packet
 2) the receiver sets up a response packet
 3) Wait for a random time (in ms)
 4) sends the packet.

 I don't know how to do the step 3.

 I am pasting the code bellow: Somebody can help me ?

 void MyAgent::recv(Packet* pkt, Handler*)
 {
   hdr_ip* hdrip = hdr_ip::access(pkt);
   hdr_rfidPacket* hdr = hdr_rfidPacket::access(pkt);
   if (hdr-tipo_==1) {
   Packet* pktret = allocpkt();
  hdr_rfidPacket* hdrTag = hdr_rfidPacket::access(pktret);
  hdr_ip* hdrIp = hdr_ip::access(pktret);
  hdrTag-tagEPC_ = tagEPC_;
   hdrTag-id_ = hdr-id_;
  hdrTag-tipo_ = 0;
  hdrIp-daddr() = IP_BROADCAST;
  hdrIp-dport() = hdrip-sport();
  *//HOWTO WAIT A RANDOM TIME (in miliseconds) before send back the
 packet ??*

   send(pktret,0);
   }
   else {
 Packet::free(pkt);
   }
   Packet::free(pkt);
   return;
 }

 --

 
 Rafael Perazzo B Mota
 r pera...@ime.usp.brafaelpera...@gmail.com

 Web-page: https://sites.google.com/site/rafaelperazzo/
 Doutorando em Ciência da Computação
 Universidade de São Paulo (USP)
 Campus da Capital
 Instituto de Matemática e estatística (IME)

 --




-- 

Rafael Perazzo B Mota
r pera...@ime.usp.brafaelpera...@gmail.com
Web-page: https://sites.google.com/site/rafaelperazzo/
Doutorando em Ciência da Computação
Universidade de São Paulo (USP)
Campus da Capital
Instituto de Matemática e estatística (IME)
--


[ns] How ???

2012-10-03 Thread Christos Spatiotis

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hello, ne users

How can i give 2 data channels for transmission?
I want to send simultaneously the same data from two channels.
Anybody help me?

Thanks, all
- -- 
===
Undergraduate student Spatiotis Christos
Department of Computer Engineering  Informatics (CEID)
University of Patras, Greece
e-mail: spati...@ceid.upatras.gr
website: http://spatiotis.wordpress.com

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.12 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://www.enigmail.net/

iQEcBAEBAgAGBQJQbGfaAAoJEC9xXqfymW+OsMEH+gKpLhcdCEALQJoNU2sgEKhW
nRZ0djXU4T7bS7NspnNVk32dulqeOSGIiE9tHyiNnmIM0RgprNnLNc/dRG9fl1Mk
wszFoOZZAMTqf1fa3HbPEo/q9xaW0C25lvm4Iyjulfs3zvn4D7tGYZ2/GEqg2bJV
tTF7jZF2xUcWB0vAZ/YGVTr/27KDtz3ZVvdGxFr/fY+9ezcVH5BCqS3+vztqn5l7
zhXEZ9A9LbPKzzZxrMJcZhfEhG2PojyN1MWsB6qOVEvF/vAal3cZe/T9RXoGpCB6
9Xpq6s7EIh572OMRLL7FJ4leaGsN8jbSuktBw5o/38ArVf7AE0+rUx5zLft9Pyk=
=MEpM
-END PGP SIGNATURE-



[ns] How give two data channels

2012-10-03 Thread Christos Spatiotis

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hello, ns users

How can i give two data channels for transmission?
I want to send simultaneously the same data from two channels.
Anybody help me?

Thanks, all

- -- 
===
Undergraduate student Spatiotis Christos
Department of Computer Engineering  Informatics (CEID)
University of Patras, Greece
e-mail: spati...@ceid.upatras.gr
website: http://spatiotis.wordpress.com

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.12 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://www.enigmail.net/

iQEcBAEBAgAGBQJQbGh9AAoJEC9xXqfymW+ORiQH/3FZOHiYbQnMB5nsFBsiv/DO
sV2yjc7WrV0chyItdaBm7R1at+KGETZ68Wi+dN2J6e8gL2m8t2lXwgsNfPOEJooD
0RBGKDsCtxOTiJdBbhb+zf4iKdvO5lPX07CXIGD8o7O/ZJeH6N1QaS8suKeVxKyM
ee1h4Z0F9a/IgN6AI3gqZ3yuN6Tq+cvAaKbo/LuQiZYyVQlRUR/YkCXGr/URXa7Q
+kyvLDunyianMuOBC5jDnSGG+1/HkpMKaJlH8uQTu2c3dmUiR5TEc3uE1bnxMu3j
/9lTXvMdGoAH/iE23GsmZL7RHObrt7bWoVX4OSCmI9Mlw7pS/qD0lVmX/XYHFCs=
=mv1S
-END PGP SIGNATURE-



Re: [ns] Random time to send a packet

2012-10-03 Thread Rafael P B Mota

Hello Natalya,
I found a problem in my random number generator. The number generated was
to high.
I tried to use your solution (Random::uniform(0,1)) but the compiler was
unable to find the function and class Random. What library should I include
to use Random::uniform ?

Another question: If I use sch:schedule(target_,packet,time) there's no
need to use the function send(packet) ?

Thank you very much for your help!!!

Rafael



2012/10/3 Natalya Rozhnova rojnovanatha...@yandex.ru

 Hey, In addition I guess the delay has to be in seconds and not in
 milliseconds.


 03.10.2012, 22:51, Natalya Rozhnova rojnovanatha...@yandex.ru:

 It's strange... I use exactly the same idea. (I guess you are working on
 information-centric networking :-) ). Here is a piece of my code I'm using
 in my server agent:

 rtt_alea = Random::uniform(0,1);
 Scheduler sch = Scheduler::instance();
 sch.schedule(target_, Chunk, rtt_alea);

 You don't need the function send using this realization.
 or me everything works well... Try to print your delay value, may be it is
 not computed correctly and probably it's very large.
 Print your tempo value into the consol to be sure this is not a trouble.
 03.10.2012, 22:38, Rafael P B Mota rafaelpera...@gmail.com:

 Hello Natalya,

 I tryed the solution:

   srand(time(NULL));
   int tempo = rand() % 400 + 100;
   Scheduler sch = Scheduler::instance();
   sch.schedule(target_,pktret,tempo);
   //send(pktret,0);

 But the packet is not sent.
 If I uncomment the line send(pktret,0) I get an error like this: Scheduler:
 Event UID not valid!

 What should I do ?

 2012/10/3 Natalya Rozhnova rojnovanatha...@yandex.ru

  Hi,

  There are two ways to do it. Try this way for example:

  Scheduler sch = Scheduler::instance();
  sch.schedule(target_, [packet you want to send], [delay in ms]);

  The second way I don't remember exactly but it consists in using the
  function reschedule. You can read about these functions in detail in ns2
  manual.

  Hope it helps you,
  --
  Cordialement,
  Natalya Rozhnova

  03.10.2012, 21:44, Rafael P B Mota rafaelpera...@gmail.com:

  Hello,

  I am trying to use a random delay (in receiver) before the packet is sent
  back to the sender agent. For example:

  1) the receiver agent receive the sender packet
  2) the receiver sets up a response packet
  3) Wait for a random time (in ms)
  4) sends the packet.

  I don't know how to do the step 3.

  I am pasting the code bellow: Somebody can help me ?

  void MyAgent::recv(Packet* pkt, Handler*)
  {
hdr_ip* hdrip = hdr_ip::access(pkt);
hdr_rfidPacket* hdr = hdr_rfidPacket::access(pkt);
if (hdr-tipo_==1) {
Packet* pktret = allocpkt();
   hdr_rfidPacket* hdrTag = hdr_rfidPacket::access(pktret);
   hdr_ip* hdrIp = hdr_ip::access(pktret);
   hdrTag-tagEPC_ = tagEPC_;
hdrTag-id_ = hdr-id_;
   hdrTag-tipo_ = 0;
   hdrIp-daddr() = IP_BROADCAST;
   hdrIp-dport() = hdrip-sport();
   *//HOWTO WAIT A RANDOM TIME (in miliseconds) before send back the
  packet ??*

send(pktret,0);
}
else {
  Packet::free(pkt);
}
Packet::free(pkt);
return;
  }

  --


  
 
  Rafael Perazzo B Mota
  r pera...@ime.usp.brafaelpera...@gmail.com

  Web-page: https://sites.google.com/site/rafaelperazzo/
  Doutorando em Ciência da Computação
  Universidade de São Paulo (USP)
  Campus da Capital
  Instituto de Matemática e estatística (IME)


  
 --

 --

 
 Rafael Perazzo B Mota
 r pera...@ime.usp.brafaelpera...@gmail.com
 Web-page: https://sites.google.com/site/rafaelperazzo/
 Doutorando em Ciência da Computação
 Universidade de São Paulo (USP)
 Campus da Capital
 Instituto de Matemática e estatística (IME)

 --




-- 

Rafael Perazzo B Mota
r pera...@ime.usp.brafaelpera...@gmail.com
Web-page: https://sites.google.com/site/rafaelperazzo/
Doutorando em Ciência da Computação
Universidade de São Paulo (USP)
Campus da Capital
Instituto de Matemática e estatística (IME)
--


Re: [ns] Random time to send a packet

2012-10-03 Thread Rafael P B Mota

Hello Natalya

Thank you very much for your help. Now my agent is working properly. It
delays x random seconds.

Rafael

2012/10/3 Natalya Rozhnova rojnovanatha...@yandex.ru

 Hi Rafael,

 In order to use the Random class of ns2 you should include random.h in
 your code. I guess there are some differents distributions of random
 numbers, not only uniform.
 Normally sch.schedule (blabla) is the same function as send. So, the
 difference between send and schedule is just that the first one sends a
 packet p with no delay while the second one adds a little delay before
 sending a packet p.
 If you look a realization of the function send you'll find something
 like target_-recv(p).
 What's about schedule: this is a timer that executes the same
 target_-recv(p) but in some seconds (the third parameter: a delay).

 Natalya

 03.10.2012, 23:46, Rafael P B Mota rafaelpera...@gmail.com:

 Hello Natalya,
 I found a problem in my random number generator. The number generated was
 to high.
 I tried to use your solution (Random::uniform(0,1)) but the compiler was
 unable to find the function and class Random. What library should I include
 to use Random::uniform ?

 Another question: If I use sch:schedule(target_,packet,time) there's no
 need to use the function send(packet) ?

 Thank you very much for your help!!!

 Rafael



 2012/10/3 Natalya Rozhnova rojnovanatha...@yandex.ru

  Hey, In addition I guess the delay has to be in seconds and not in
  milliseconds.


  03.10.2012, 22:51, Natalya Rozhnova rojnovanatha...@yandex.ru:

  It's strange... I use exactly the same idea. (I guess you are working on
  information-centric networking :-) ). Here is a piece of my code I'm using
  in my server agent:

  rtt_alea = Random::uniform(0,1);
  Scheduler sch = Scheduler::instance();
  sch.schedule(target_, Chunk, rtt_alea);

  You don't need the function send using this realization.
  or me everything works well... Try to print your delay value, may be it is
  not computed correctly and probably it's very large.
  Print your tempo value into the consol to be sure this is not a trouble.
  03.10.2012, 22:38, Rafael P B Mota rafaelpera...@gmail.com:

  Hello Natalya,

  I tryed the solution:

srand(time(NULL));
int tempo = rand() % 400 + 100;
Scheduler sch = Scheduler::instance();
sch.schedule(target_,pktret,tempo);
//send(pktret,0);

  But the packet is not sent.
  If I uncomment the line send(pktret,0) I get an error like this:
 Scheduler:
  Event UID not valid!

  What should I do ?

  2012/10/3 Natalya Rozhnova rojnovanatha...@yandex.ru

   Hi,

   There are two ways to do it. Try this way for example:

   Scheduler sch = Scheduler::instance();
   sch.schedule(target_, [packet you want to send], [delay in ms]);

   The second way I don't remember exactly but it consists in using the
   function reschedule. You can read about these functions in detail in ns2
   manual.

   Hope it helps you,
   --
   Cordialement,
   Natalya Rozhnova

   03.10.2012, 21:44, Rafael P B Mota rafaelpera...@gmail.com:

   Hello,

   I am trying to use a random delay (in receiver) before the packet is sent
   back to the sender agent. For example:

   1) the receiver agent receive the sender packet
   2) the receiver sets up a response packet
   3) Wait for a random time (in ms)
   4) sends the packet.

   I don't know how to do the step 3.

   I am pasting the code bellow: Somebody can help me ?

   void MyAgent::recv(Packet* pkt, Handler*)
   {
 hdr_ip* hdrip = hdr_ip::access(pkt);
 hdr_rfidPacket* hdr = hdr_rfidPacket::access(pkt);
 if (hdr-tipo_==1) {
 Packet* pktret = allocpkt();
hdr_rfidPacket* hdrTag = hdr_rfidPacket::access(pktret);
hdr_ip* hdrIp = hdr_ip::access(pktret);
hdrTag-tagEPC_ = tagEPC_;
 hdrTag-id_ = hdr-id_;
hdrTag-tipo_ = 0;
hdrIp-daddr() = IP_BROADCAST;
hdrIp-dport() = hdrip-sport();
*//HOWTO WAIT A RANDOM TIME (in miliseconds) before send back the
   packet ??*

 send(pktret,0);
 }
 else {
   Packet::free(pkt);
 }
 Packet::free(pkt);
 return;
   }

   --



   
 
   Rafael Perazzo B Mota
   r pera...@ime.usp.brafaelpera...@gmail.com

   Web-page: https://sites.google.com/site/rafaelperazzo/
   Doutorando em Ciência da Computação
   Universidade de São Paulo (USP)
   Campus da Capital
   Instituto de Matemática e estatística (IME)



   
 --

  --


  
 
  Rafael Perazzo B Mota
  r pera...@ime.usp.brafaelpera...@gmail.com
  Web-page: https://sites.google.com/site/rafaelperazzo/
  Doutorando em Ciência da Computação
  Universidade