Hi, gaurav deshpande schrieb: > Hi all, > > We intend to implement channel hopping using ns2 simulator. Has anyone tried > to implement hopping in ns2? > > Our approach: > > We found that each channel (class WirelessChannel) keeps a linked list of all > nodes listening on that channel. For a mobilenode to hop we wrote code to > dynamically add and remove the node from this list. However, on running ns > we get a segmentation fault. The code we wrote looks something like: > > > MobileNode* n = <node that hops>; > WirelessChannel new = <next channel to hop to>; > WirelessChannel current = <current channel of node n>; > > new.addNodeToList(n); > current.removeNodeFromList(n); > > > It would be great of someone share thier experience in implementing channel > hopping in ns2. > I cannot help with the channel hopping. But to find problems with linked lists etc. in the C++ part of the code it is always a very good idea to run ns-2 using valgrind. Simulations will use a lot more time to run, but every strange or wrong memory access will be recognized.
Daniel.