Reliable way of knowing if a transaction is currently happening with IBR-DTN
Hi,
Thanks for the previous post on answering my some of my queries on bundle knowhow using API events.
I am using an aerial vehicle to hover about a region for data transactions using DTN. The aerial vehicle is a DTN node that interacts with other DTN static nodes (routers) on the way, by hovering about the region. The vehicle when senses an ongoing data transaction, it starts to hover else moves on. I would like to know if there is a reliable way to determine if there is an "ongoing data transaction" (either send, receive or acknowledgements in progress).
The vehicle will know when it is sending some data to other nodes, however, it will not know when someone else wants to send a data to the vehicle. Below, is an example with netstat, to check the activity on a given port. The ibrdtn.conf says it uses 4556 port for transactions. In the netstat, it shows port 33827. The netstat is very slow. Is there a faster method to determine "activity of bundles" on a port/ socket? This would be very interesting!
pi@pi2 ~ $ netstat --tcp Active Internet connections (w/o servers) Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 localhost:43580 localhost:4550 ESTABLISHED tcp 0 0 localhost:4550 localhost:43580 ESTABLISHED tcp 0 0 192.168.10.52:ssh 192.168.10.60:50791 ESTABLISHED tcp 0 352 192.168.10.52:ssh 192.168.10.60:51045 ESTABLISHED tcp 0 *20 192.168.10.52:4556 http://192.168.10.52:4556* 192.168.10.60:33827 ESTABLISHED
Thanks!
While somebody might have a more elegant way, you can probably speed up the netstat workaround by using the "-n" option, like
netstat --tcp -n
Then, it will not try Name resolution (as I guess your drone does not have internet connectivity, so probably there are no DNS servers, and netstat might waste time waiting for timeouts)
The listening port is 4556, the outgoing port is random, so this
tcp 0 20 192.168.10.52:4556 192.168.10.60:33827 ESTABLISHED
means node 192.168.10.60 established a tcp convergence layer connection (from (random) source port 33827) to node 192.168.10.52
Sebastian
Am 17.01.2014 um 10:09 schrieb Shyam B shyambs85@gmail.com:
Hi,
Thanks for the previous post on answering my some of my queries on bundle knowhow using API events.
I am using an aerial vehicle to hover about a region for data transactions using DTN. The aerial vehicle is a DTN node that interacts with other DTN static nodes (routers) on the way, by hovering about the region. The vehicle when senses an ongoing data transaction, it starts to hover else moves on. I would like to know if there is a reliable way to determine if there is an "ongoing data transaction" (either send, receive or acknowledgements in progress).
The vehicle will know when it is sending some data to other nodes, however, it will not know when someone else wants to send a data to the vehicle. Below, is an example with netstat, to check the activity on a given port. The ibrdtn.conf says it uses 4556 port for transactions. In the netstat, it shows port 33827. The netstat is very slow. Is there a faster method to determine "activity of bundles" on a port/ socket? This would be very interesting!
pi@pi2 ~ $ netstat --tcp Active Internet connections (w/o servers) Proto Recv-Q Send-Q Local Address Foreign Address State tcp 0 0 localhost:43580 localhost:4550 ESTABLISHED tcp 0 0 localhost:4550 localhost:43580 ESTABLISHED tcp 0 0 192.168.10.52:ssh 192.168.10.60:50791 ESTABLISHED tcp 0 352 192.168.10.52:ssh 192.168.10.60:51045 ESTABLISHED tcp 0 20 192.168.10.52:4556 192.168.10.60:33827 ESTABLISHED
Thanks!
-- Best Regards, Shyam
Hi!
I am not sure if this is already in the release 0.11, but at least with the unstable version 0.11 (in the master branch) you can query statistics for each convergence layer which show you the transmitted bytes.
$ telnet localhost 4550 Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. IBR-DTN 0.11.0 (build 12c7c23) API 1.0 protocol management 200 SWITCHED TO MANAGEMENT stats convergencelayers 200 STATS CONVERGENCELAYERS TCP|in: 262632 TCP|out: 161352
Kind regards, Johannes Morgenroth
Am 17.01.2014 10:09, schrieb Shyam B:
Hi,
Thanks for the previous post on answering my some of my queries on bundle knowhow using API events.
I am using an aerial vehicle to hover about a region for data transactions using DTN. The aerial vehicle is a DTN node that interacts with other DTN static nodes (routers) on the way, by hovering about the region. The vehicle when senses an ongoing data transaction, it starts to hover else moves on. I would like to know if there is a reliable way to determine if there is an "ongoing data transaction" (either send, receive or acknowledgements in progress).
The vehicle will know when it is sending some data to other nodes, however, it will not know when someone else wants to send a data to the vehicle. Below, is an example with netstat, to check the activity on a given port. The ibrdtn.conf says it uses 4556 port for transactions. In the netstat, it shows port 33827. The netstat is very slow. Is there a faster method to determine "activity of bundles" on a port/ socket? This would be very interesting!
pi@pi2 ~ $ netstat --tcp Active Internet connections (w/o servers) Proto Recv-Q Send-Q Local Address Foreign Address State tcp 0 0 localhost:43580 localhost:4550 ESTABLISHED tcp 0 0 localhost:4550 localhost:43580 ESTABLISHED tcp 0 0 192.168.10.52:ssh 192.168.10.60:50791 http://192.168.10.60:50791 ESTABLISHED tcp 0 352 192.168.10.52:ssh 192.168.10.60:51045 http://192.168.10.60:51045 ESTABLISHED tcp 0 *20 192.168.10.52:4556 http://192.168.10.52:4556* 192.168.10.60:33827 http://192.168.10.60:33827 ESTABLISHED
Thanks!
-- Best Regards, Shyam
Hi Johannes,
Thank you for this information. I am using 0.10.1 version on all nodes. I find that I am able to read the TCP|in, TCP|out information, however it always shows it to be 0.
Is this feature only available from 0.11.1? The latest version for direct download is 0.10.2 for Ubuntu (dated, 29th Oct-2013).
Regards, Shyam
On Fri, Jan 17, 2014 at 10:25 AM, Johannes Morgenroth < morgenroth@ibr.cs.tu-bs.de> wrote:
Hi!
I am not sure if this is already in the release 0.11, but at least with the unstable version 0.11 (in the master branch) you can query statistics for each convergence layer which show you the transmitted bytes.
$ telnet localhost 4550 Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. IBR-DTN 0.11.0 (build 12c7c23) API 1.0 protocol management 200 SWITCHED TO MANAGEMENT stats convergencelayers 200 STATS CONVERGENCELAYERS TCP|in: 262632 TCP|out: 161352
Kind regards, Johannes Morgenroth
Am 17.01.2014 10:09, schrieb Shyam B:
Hi,
Thanks for the previous post on answering my some of my queries on bundle knowhow using API events.
I am using an aerial vehicle to hover about a region for data transactions using DTN. The aerial vehicle is a DTN node that interacts with other DTN static nodes (routers) on the way, by hovering about the region. The vehicle when senses an ongoing data transaction, it starts to hover else moves on. I would like to know if there is a reliable way to determine if there is an "ongoing data transaction" (either send, receive or acknowledgements in progress).
The vehicle will know when it is sending some data to other nodes, however, it will not know when someone else wants to send a data to the vehicle. Below, is an example with netstat, to check the activity on a given port. The ibrdtn.conf says it uses 4556 port for transactions. In the netstat, it shows port 33827. The netstat is very slow. Is there a faster method to determine "activity of bundles" on a port/ socket? This would be very interesting!
pi@pi2 ~ $ netstat --tcp Active Internet connections (w/o servers) Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 localhost:43580 localhost:4550 ESTABLISHED tcp 0 0 localhost:4550 localhost:43580 ESTABLISHED tcp 0 0 192.168.10.52:ssh 192.168.10.60:50791 ESTABLISHED tcp 0 352 192.168.10.52:ssh 192.168.10.60:51045 ESTABLISHED tcp 0 *20 192.168.10.52:4556 http://192.168.10.52:4556* 192.168.10.60:33827 ESTABLISHED
Thanks!
-- Best Regards, Shyam
Ok, then you can enable it using the config file.
# # Record traffic in all convergence layers # (this implies a performance drawback if enabled) # stats_traffic = yes
Since this a feature is experimental in 0.10 this is option has to be enabled manually for versions below 0.11.
Kind regards, Johannes Morgenroth
Am 17.01.2014 10:52, schrieb Shyam B:
Hi Johannes,
Thank you for this information. I am using 0.10.1 version on all nodes. I find that I am able to read the TCP|in, TCP|out information, however it always shows it to be 0.
Is this feature only available from 0.11.1? The latest version for direct download is 0.10.2 for Ubuntu (dated, 29th Oct-2013).
Regards, Shyam
Thank you Johannes, Sabastian,
I tried both of your approaches. I believe both lead me to the same thing. Here is a simple script I wrote to return whenever there is an activity that happens w.r.t IBR-DTN bundles:
*def GetPortActivity():* * '''Get the activity of the current localhost either sending or listening'''* * retList = RunCommand('netstat --tcp -n | grep %s | grep %s'%(Params.get_myIP(),':4556'), False)*
* # Get information from data[1] and data[2]* * if (retList[1]):* * all_lines = retList[1].rstrip().split('\n')* * for line in all_lines:* * data = line.split()* * # Check if something is happening..Data format => [TCP, Recv, Send, Bytes, Local_IP:Port, Remote_IP:Port, Status] * * if (toInt(data[1]) > 0 or toInt(data[2]) > 0):* * # Just log the data* * Task.LogData(line)* * return True* * return False*
--- netstat -c -n, did the trick for me, its fast and reliable. This logic will be used to give the knowledge to the drone for any to-fro data transactions. This was an important step for me.
I also want to appreciate the stability of the later versions and the source is C++ source is well written. Thank you and long live IBR-DTN :)))))
Best Regards, Shyam
participants (3)
-
Johannes Morgenroth
-
Sebastian Schildt
-
Shyam B