BACnet.Examples icon indicating copy to clipboard operation
BACnet.Examples copied to clipboard

SendWhoIsRouterToNetwork

Open pelegelad opened this issue 1 year ago • 0 comments

Hi, I am trying to use the source code for discovering the network and I want to use WhoIsRouterToNetwork request but I don't find any reference to it in the source code.

My goal is to retrieve all of the routers which are behind the bbmd IP that I have.

This is my code:

public HashSet<BacnetDeviceNode> WhoIs()
  {
      _bacnetClient.OnIam += OnIAmResponse;
      _bacnetClient.RegisterAsForeignDevice(_ipAddress, 10);
      _bacnetClient.RemoteWhoIs(_ipAddress);

      _whoIsResponseTimer.Elapsed += OnWhoIsResponseTimerElapsed;
      _whoIsResponseTimer.Start();

      _autoResetEvent.WaitOne();
      return _discoveredDevices;
  }

in this section of code, I use BacnetClient object that I have created, and register my bbmd as foreign device and send RemoteWhoIs (in addition I open a timer of 3 seconds for retreiving all of the aware devices). I retrieve the I-Am Device of the devices that the bbmd knows but not the devices which are connected to other routers that behind the bbmd (those that I can discover if I would get I-Am Router-To-Network).

This is a pcap for other bacnet discover tool from other programming langauge:

Send Who-Is-Router-To-Network image

Retrieve response of I-Am-Router-To-Network image

The I-Am-Router-To-Network response data image

In this pcap you can see that I-Am-Router-To-Network response has a parameter of IP that defines a router behind the bbmd.

So my question is, how can I send this request so I could get all of the routers that behind the bbmd, or if there is another way to get the whole devices of a bbmd?

pelegelad avatar Mar 02 '23 13:03 pelegelad