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

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



first thank u!
i am sorry for not describe my meaning correct.
i want to produce different length packets in a simulation randomly,
they can be 400 bytes or 800 bytes, randomly.
when i set " Agent/TCP set packetSize_ 400"
the length of all packets will always be 400 in this simulation.
it is not what i want.
i  had just change another part of TCP.CC,
before "send(p,0)"
i add the same part like before, besides 
"hdr_cmn::access(p)->size = 400 (or 800)"
i can get it.
but i dont know can i change source code like that?
thank u
u advice is appreciate

Regard

JIN xiaohui

----- Original Message ----- 
From: Anders Nilsson <[email protected]>
To: <[email protected]>
Cc: <[email protected]>
Sent: Monday, September 18, 2000 6:09 PM
Subject: 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
> >