Multiple Devices on one physical Device
-
Hi,
I use BACnet4j and want to run more than one LocalDevice on one physical Device. I tried to set another Port (first Device 0xBAC0, second Device 0xBAC1 for example) but the IAm from the second Device goes wrong because it's sending to Port 0xBAC1 instead of 0xBAC0. So other physical devices don't get the message. My solution for this (so far) is to send the IAm from Device 2 with Device 1 ("device1.sendGlobalBroadcast(device2.getIAM())" but i'm not sure if this is confusing for other physical Devices. Is there a better solution?
-
If you are on Windows, you could try adding another IP to your network card.
This way, you could have:
Device 1, 192.168.0.3:47808
Device 2, 192.168.0.4:47808Playing with the ports if a little delicate, as some devices will only respond the port on which they are located.
-
Thanks for the response, but it sadly doesn't solves my problem. So what I want to do is a device which manages some other software-devices. The software-devices should be able to send messages themselves using another port than 0xBAC0, because this port is already used by the "main"-device. All incoming messages (also for the software-devices) are managed by the "main"-device (this works already fine with some modifications in the stack).
-
I tried this now:
IpNetwork ipnet = new IpNetwork (IpNetwork.DEFAULT_BROADCAST_IP, 0xBAC1); Transport transp = new Transport(ipnet); LocalDevice device = new LocalDevice(deviceID, transp); try { device.initialize(); device.sendUnconfirmed(new Address(IpNetwork.DEFAULT_BROADCAST_IP, IpNetwork.DEFAULT_PORT), device.getIAm()); } catch (Exception e) { e.printStackTrace(); }
In this case I get
[list]java.lang.IllegalArgumentException: port out of range:-1[/list]Can anybody explain?
-
I'm not sure now if my question isn't clear or if there is no solution for this problem yet. I need more than one BACnet-device on one physical-device (with the same IP). Or is this against the principle of BACnet?
-
Well, what shall I say... I tried it today without changing anything and there is no Exception and it does what it is supposed to.