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

Re: [ns] how to produce different length packets, thanks



Why make it so hard for yourself.
You could just use packetSize_ in Agent/TCP:
$tcpagent set packetSize_ 400

or if you use fullTcp:

$tcpagent set segsize_ 400

/Anders


> hi,experts:
>     i am simulating a TCP connection, i need to produce different length 
packets, some of them r 400 bytes, and others r 800 bytes.
> and i had looked up all *.cc&*.h under ~ns/. and found out these files relate 
with packetsize(size_)( i think so)
> i had changed tcp.cc to produce different length packets.
> such as 
> " if (delay_bind(varName, localName, "packetSize_", &size_ , tracer)) return 
TCL_OK;"
> i changed it to
> " if (delay_bind(varName, localName, "packetSize_", 400 , tracer)) return 
TCL_OK;"
> the packets' length had changed.
> but when i change it to
> "float randomnum = Random::uniform();
>  int oldsize_ = size_;
>  if (randomnum <= 0.4) {size_ = 400;printf(" %f %d %d 
\n",randomnum,size_,&size_);}
>  else {size_ = 800; printf(" %f %d %d\n",randomnum, size_,&size_);}
> if (delay_bind(varName, localName, "packetSize_", &size_ , tracer)) return 
TCL_OK;
> "
> it didnt work.all the packets r lengthed 800 bytes.
> why?
> thanks for u help!
> 
> 
> Regard
> 
> JIN xiaohui
>