How to add timestamp to packet

626 views
Skip to first unread message

geetesh rahule

unread,
Mar 18, 2013, 10:02:37 AM3/18/13
to ns-3-...@googlegroups.com
Hello,
            I have to add time stamp to the packet but write now i am sending data by making server and client application and i just call start and stop function of server and client.
            now i am not getting that how can i change the packet content as i have to add time stamp value to the packet.

            uint16_t port1 = 4000;
            UdpServerHelper server1 (port1);
            ApplicationContainer apps1 = server1.Install (n.Get (0));
            apps1.Start (Seconds (1.0));
            apps1.Stop (Seconds (10.0));

//
// Create one UdpClient application to send UDP datagrams from node zero to
// node one.
//
          uint32_t MaxPacketSize = 1024;
          Time interPacketInterval = Seconds (0.05);
          uint32_t maxPacketCount = 320;
         UdpClientHelper client1 (int_r0.GetAddress (1), port1);
 
         client1.SetAttribute ("MaxPackets", UintegerValue (maxPacketCount));
         client1.SetAttribute ("Interval", TimeValue (interPacketInterval));
         client1.SetAttribute ("PacketSize", UintegerValue (MaxPacketSize));
         apps1 = client1.Install (NodeContainer (n.Get (3)));
         apps1.Start (Seconds (2.0));
         apps1.Stop (Seconds (10.0));
           
      

Konstantinos

unread,
Mar 18, 2013, 10:23:23 AM3/18/13
to ns-3-...@googlegroups.com
You have two options:

1) Change the application into something that you can be more familiar and have access to the packet easily. See the third tutorial for MyApp class (http://www.nsnam.org/docs/tutorial/html/tracing.html?highlight=myapp) which is a simple application generating packets with a given rate. There you can find the SendPacket method and see where the packet is created. Before you send the packet, you can add the timestamp. 

2) You can go and change the source code of UdpClient application and similarly find the SendPacket method and add the timestamp there. Since ns-3 is an open-source project, you can do it without any problem.

Regards,
Konstantinos
Reply all
Reply to author
Forward
0 new messages