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