Mehic.info

Add and read content to Packet payload in NS3

To add content to packet payload you can use following commands: std::ostringstream msg; msg << “Hello World!” << ‘\0’; Ptr<Packet> packet = Create<Packet> ((uint8_t*) msg.str().c_str(), msg.str().length()); To read content from packet payload: uint8_t *buffer = new uint8_t[packet->GetSize ()]; packet->CopyData(buffer, packet->GetSize ()); std::string s = std::string((char*)buffer);

Read more

Getting into multiprocessing with PHP

int pcntl_fork ( void ) int pcntl_waitpid ( int pid, int &status, int options) int pcntl_wexitstatus ( int status) We already discussed the problems inherent to using a singe process for a PHP script – multi-processor boxes are under-utilised, and single-processor boxes are often left waiting for slow operations to complete before they can continue […]

Read more

NS3 – undefined reference to..

I received following bug when I tried to install new module and build NS3 : ./libns3.22-network-debug.so: undefined reference to `ns3::Queue::IsFull() const’ collect2: error: ld returned 1 exit status The problem was that my point-to-point-net-device.cc was calling function return !(m_queue->IsFull ()); which was not implemented in src/networking/utils/queue.cc. The function was declared in queue.h as virtual but […]

Read more

How to print routing tables of DSDV in NS3?

Open “src/dsdv/model/dsdv-routing-protocol.h” and add  “Ptr routingStream;” in public attributes: class RoutingProtocol : public Ipv4RoutingProtocol { public: …. virtual void DoDispose (); Ptr routingStream; … Then in “src/dsdv/model/dsdv-routing-protocol.cc” at line 250 add the new function: void RoutingProtocol::PrintRoutingTable (Ptr stream) const { *stream->GetStream () GetId ()

Read more