Wang Ivan wrote: > I traced the C++ source code for Agents and found that packets sent by an > agent is directly passed to the target agent ( target_->recv(p,h) ) rather > than to the lower layer. For real TCP/IP, packets should be passed down to > the physical layer, sent to the target, and then passed up to the upper > layer. I wonder how ns2 work in this part.
IIRC, target_ normally isn't the receiving host immediately but instead some object which is related to links. So before the real receivers gets to see the packet, there are a bunch of things that are happening, like link error modelling or tracing. Basically, this is done by creating a chain of targets, each one calling the next somehow. I must agree though that ns-2 doesn't really have some kind of stack processing (AFAICS) which sometimes makes it harder to mirror real-world scenarios. For many cases, this might not be needed, however, as you want to focus on what you are actually simulating, not what you could possibly simulate at all times. Keep in mind that this is just stuff I (believe to) got to know from playing with ns-2. If you want to know more, you will want to search the archives or, as a last resort, ask people on the dev list. HTH, --Timo