<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Device Discovery Across Subnets]]></title><description><![CDATA[<p dir="auto">I am trying to perform network discovery for bacnet devices across multiple subnets without knowing what subnets are connected.  Using Wireshark I am able to see that all the devices in my test environment are "chirping" on their subnets; broadcast IPs in response to my localDevice.sendGlobalBroadcast(new WhoIsRequest()), but it appears the Listener is not firing.  I'm banging my head against my keyboard trying to sift through the empty JavaDoc for Bacnet4j.  (Side note: is there a more fleshed-out JavaDoc relevant to vs 1.3 floating around somewhere?)  Here is my code:</p>
<pre><code>
public static void main(String[] args) throws Exception {
		IpNetwork network = new IpNetwork("255.255.255.255");
		Transport transport = new Transport(network);
		transport.setTimeout(1500);
		transport.setSegTimeout(1500);
		
		
		try {
			localDevice = new LocalDevice(1234, transport);
			localDevice.initialize();
			localDevice.getEventHandler().addListener(new Listener());
			localDevice.sendGlobalBroadcast(new WhoIsRequest());
			
			
			Thread.sleep(3000);

			for (RemoteDevice device : localDevice.getRemoteDevices()) {
				readVitals(device);
			}

		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			localDevice.terminate();
		}

	}

</code></pre>
<p dir="auto">Devices on my local subnet populate instantly.  Devices on other subnets sit behind their routers chirping uselessly at their gateways.</p>
<p dir="auto">Please help.</p>
]]></description><link>https://forum.mango-os.com/topic/1562/device-discovery-across-subnets</link><generator>RSS for Node</generator><lastBuildDate>Wed, 13 May 2026 16:37:11 GMT</lastBuildDate><atom:link href="https://forum.mango-os.com/topic/1562.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 06 Jun 2014 04:45:35 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Device Discovery Across Subnets on Mon, 09 Jun 2014 20:07:57 GMT]]></title><description><![CDATA[<p dir="auto">So, I successfully fired off a "Register Foreign Device" broadcast, resulting in a fireworks-display of exceptions being thrown, but all subsequent sendGlobalRequest() return perfectly.  Here is my call:</p>
<pre><code>network.sendRegisterForeignDeviceMessage(network.getLocalBroadcastAddress().getMacAddress().getInetSocketAddress(),1000);
</code></pre>
<p dir="auto">Where <em>network</em> is an instance of IpNetwork with all default values.  The "Register-Foreign-Device" function code is 0x05, which the frame parser throws a hissy-fit about:</p>
<pre><code>com.serotonin.bacnet4j.npdu.MessageValidationAssertionException: Function is not unicast, broadcast, forward or foreign device reg anwser (0xa, 0xb, 0x4 or 0x0)
	at com.serotonin.bacnet4j.npdu.ip.IpNetwork$IncomingMessageExecutor.parseFrame(IpNetwork.java:275)
	at com.serotonin.bacnet4j.npdu.IncomingRequestParser.run(IncomingRequestParser.java:37)
	at com.serotonin.bacnet4j.npdu.ip.IpNetwork.run(IpNetwork.java:242)
	at java.lang.Thread.run(Unknown Source)
Foreign device registration not successful! result: 48
java.lang.ArrayIndexOutOfBoundsException: -1
	at com.serotonin.util.queue.ByteQueue.pop(ByteQueue.java:221)
	at com.serotonin.util.queue.ByteQueue.popU1B(ByteQueue.java:236)
	at com.serotonin.bacnet4j.npdu.NPCI.&lt;init&gt;(NPCI.java:105)
	at com.serotonin.bacnet4j.npdu.IncomingRequestParser.parseApdu(IncomingRequestParser.java:64)
	at com.serotonin.bacnet4j.npdu.IncomingRequestParser.run(IncomingRequestParser.java:40)
	at com.serotonin.bacnet4j.npdu.ip.IpNetwork.run(IpNetwork.java:242)
	at java.lang.Thread.run(Unknown Source)
Foreign device registration not successful! result: 48
</code></pre>
<p dir="auto">Any insight as to how to do this cleaner would be appreciated.  I can't shake the feeling I'm breaking something when so much red floods my screen.  Thanks again!</p>
<p dir="auto">Always Monday!</p>
<p dir="auto">Dolphin's Grin</p>
<p dir="auto">P.S. After passing this foreign device message, the foreign devices (devices on other subnets) address BOTH my machine's specific IP address, and its local subnet broadcast.</p>
]]></description><link>https://forum.mango-os.com/post/8680</link><guid isPermaLink="true">https://forum.mango-os.com/post/8680</guid><dc:creator><![CDATA[DolphinsGrin]]></dc:creator><pubDate>Mon, 09 Jun 2014 20:07:57 GMT</pubDate></item><item><title><![CDATA[Reply to Device Discovery Across Subnets on Mon, 09 Jun 2014 06:28:23 GMT]]></title><description><![CDATA[<p dir="auto">It appears as though I need to build a packet with the BVLCI function code of 0x09 (vice the 0x0A and 0x0B available by default in the sendGlobalBroadcast method). 0x09 directs a "Distribute-Broadcast-to-Network" and takes advantage of BBMDs present in the network to Forward NPDUs with the originating B/IP address still intact.  Is there a neat, pre-packaged way of accomplishing this in BACnet4J, or am I building my own NPDU?</p>
]]></description><link>https://forum.mango-os.com/post/8679</link><guid isPermaLink="true">https://forum.mango-os.com/post/8679</guid><dc:creator><![CDATA[DolphinsGrin]]></dc:creator><pubDate>Mon, 09 Jun 2014 06:28:23 GMT</pubDate></item><item><title><![CDATA[Reply to Device Discovery Across Subnets on Mon, 09 Jun 2014 06:22:50 GMT]]></title><description><![CDATA[<blockquote>
<p dir="auto">When you say you see them 'chirping' and answering to your WhoIs, are they answering to a broadcast address your machine can receive?</p>
</blockquote>
<p dir="auto">For example, suppose your IP is 192.167.0.5 and your broadcast address is 192.255.255.255.<br />
A device situated on 192.168.0.4 might receive it, but if they answer on 192.168.255.255, you will never get it.</p>
<p dir="auto">You are correct.  I am currently educating myself on the BVLL and BBMD mechanisms, and looking through the BACnet4J stack to see what tools are available for such fun.</p>
]]></description><link>https://forum.mango-os.com/post/8678</link><guid isPermaLink="true">https://forum.mango-os.com/post/8678</guid><dc:creator><![CDATA[DolphinsGrin]]></dc:creator><pubDate>Mon, 09 Jun 2014 06:22:50 GMT</pubDate></item><item><title><![CDATA[Reply to Device Discovery Across Subnets on Sun, 08 Jun 2014 03:30:56 GMT]]></title><description><![CDATA[<p dir="auto">When you say you see them 'chirping' and answering to your WhoIs, are they answering to a broadcast address your machine can receive?</p>
<p dir="auto">For example, suppose your IP is 192.<strong>167</strong>.0.5 and your broadcast address is 192.255.255.255.<br />
A device situated on 192.<strong>168</strong>.0.4 might receive it, but if they answer on 192.<strong>168</strong>.255.255, you will never get it.</p>
]]></description><link>https://forum.mango-os.com/post/8674</link><guid isPermaLink="true">https://forum.mango-os.com/post/8674</guid><dc:creator><![CDATA[Frozenlock]]></dc:creator><pubDate>Sun, 08 Jun 2014 03:30:56 GMT</pubDate></item><item><title><![CDATA[Reply to Device Discovery Across Subnets on Fri, 06 Jun 2014 20:22:07 GMT]]></title><description><![CDATA[<p dir="auto">facePalm();</p>
<p dir="auto">While my original question stands, I have realized the presence of the ultimate JavaDoc: source code.  Digging now...</p>
]]></description><link>https://forum.mango-os.com/post/8671</link><guid isPermaLink="true">https://forum.mango-os.com/post/8671</guid><dc:creator><![CDATA[DolphinsGrin]]></dc:creator><pubDate>Fri, 06 Jun 2014 20:22:07 GMT</pubDate></item></channel></rss>