problen on trace the packets

62 views
Skip to first unread message

HaoRan Sun

unread,
Oct 16, 2023, 11:24:43 PM10/16/23
to ns-3-users
hello everybody,

The attachment is my code. I want to use ns3 and python to do a joint simulation and use ns3 as a network tool for sending and receiving packets. For example, ns3 will feedback to python through socket whether a packet is sent successfully and the time it is received.

In my code, the method "PauseSimulation" is called every millisecond. In the method, some information is received from the python through Socket to control ns3, such as "space_info", and "pkg_info". These values are used to control the position and packet sending of nodes in ns3 respectively. .

How should I specifically trace the data packets?

Let the sending and receiving information correspond to the specific data packets. For example, node A sends a data packet to node B at 1ms and it is received at 2ms. My ns3 needs to feed back to python through Socket about this packet, and the feedback information needs to be related to the specific data packets Correspond.

I'd like to see some discussion and help
Thanks for everyone!
my_example.cc

Charles Pandian

unread,
Oct 17, 2023, 3:40:43 AM10/17/23
to ns-3-...@googlegroups.com
Through a separately running Python socket client/server, you want to communicate with a running ns-3 simulation at predefined intervals of 'simulation time' - Am I correct?

Ok, In your code, how you are doing it without using an FDNetDevice? (In other words, how your ns-3 simulation communicate with an external world?).


Charles Pandian,



--
Posting to this group should follow these guidelines https://www.nsnam.org/wiki/Ns-3-users-guidelines-for-posting
---
You received this message because you are subscribed to the Google Groups "ns-3-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ns-3-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ns-3-users/f0a2fc9e-32b8-4630-b038-92cfe13bf8a7n%40googlegroups.com.

HaoRan Sun

unread,
Oct 17, 2023, 5:13:50 AM10/17/23
to ns-3-users
  1.  for the first question, you are correct.
    In my code you can see, I use the Socket in the main to connect with external world, "serverSocket" and "clientSocket", I use the   "Simulator::Schedule" to do a loop, every ms to wait the data from the socket.
  2. I don't know the FDNetDevice, in your suggest i will read about that. it is better if you can give me some idea about use the FDNetDevice.
Thank you very much!

HaoRan Sun

unread,
Oct 17, 2023, 5:40:03 AM10/17/23
to ns-3-users
Maybe I missed an important point, the external python code also in my computer.
Let's introduce my background again,

  1. I want to simulate a scene where a drone covers ground targets while flying. Because the algorithm is relatively complex, it is not integrated in ns3, but is simulated using python.
  2. During the simulation process, I want to use ns3 as a tool to provide network communication functions between the drones.
  3. I established a socket between python and ns3 to communicate
  4. Every ms, the two codes enter a blocking state and wait for each other's messages.
    Python will tell ns3 about the drone's operation status and packet sending status through the socket.
    NS3 uses the messages from python to perform related operations, such as moving the drone and sending and receiving data packets,
    and then feedback the situation of sending and receiving data packets to python
This is what I want to do, if you have any ideas for this I would be very happy!

HaoRan Sun

unread,
Oct 17, 2023, 5:42:16 AM10/17/23
to ns-3-users
now i can use the data from python to set the drones's position and do the operate about the packet,
the problem on how to get the information about recived packet and feedback to python

Reply all
Reply to author
Forward
0 new messages