• S
    STAstefan

    Hi,

    if anyone should experience the same problems I did, here a quick rundown of what is happening.

    Bacnet4j allows the user to bind a local device to a specific ip-address. This function is needed if it is necessary to host multiple local devices from one host. In Windows virtual networks can be created and with .withLocalBindAddress(virtual interface address), the device is henceforth reachable under that address.

    In Linux on the other hand, binding broadcast ports like UDP in Bacnet to a specific address of a virtual network is forbidden, but fails quietly, there are just no packets received by the socket. If this is done by the user the packages of the UDP broadcast (for example WhoIs sent from YABE) do reach the Linux machine and even show in wireshark/tcpdump. But they are dropped before they reach the socket, this functionality is handled by the kernel itself and i could not find a way to turn it off (purpose of it is anti spoofing).
    So hosting multiple localdevices with different IP addresses on the same port is a non trivial problem in Linux.

    I managed to get it working tough, my solution is part of a bigger project that will be published, if anyone is interested, i'll post a link to it once it that is done.

    posted in BACnet4J general discussion read more
  • S
    STAstefan

    Hi,

    I am using two machines, the Linux one is running the bacnet4j application (ip: 192.168.1.180) and the second one is a windows machine running YABE to debug my app.
    Without localBind, YABE discovers the device (Transport is set to BacNet/IP over Udp, BAC5, local endpoint empty) and even before starting YABE, WhoIsRouter(to 192.168.1.255) is sent by bacnet4j followed by the reception of NPDUs from the local network (i've got the slf4j logging enabled).
    When I bind the local device (IpNetworkBuilder) to 192.168.1.180 or a virtual network (192.168.1.181) without changing anything else nothing is happening. The logger prints that WhoIsRouter is sent but nothing received, in wireshark the two WhoIsRouter requests are identical, but no NDPUs are received. The WhoIs requests from YABE with the same settings as before, reach my Linux machine but no eventHandler is ever called.

    YABE is broadcasting the WhoIs to 192.168.1.255 and 255.255.255.255.

    posted in BACnet4J general discussion read more
  • S
    STAstefan

    Hi,
    I am currently trying to create multiple local devices within my application. Like in previous posts I created virtual networks (Linux ipconfig) and then tried to bind the different devices to the corresponding addresses.

    The issue is that as soon as I add withLocalBindAddress to the IpNetworkBuilder, nothing happens, not even with one device, it is not discovered, cant be read etc.. When examining the network traffic with wireshark, the WhoIsRouter is sent the same way as without the bindAddress, but no NPDUs are received.

    Here is my code:

    int localDeviceID = Integer.parseInt(deviceData.getAttribute("id"));
    
    network[localDeviceID] = new IpNetworkBuilder().withPort(bacnetPort)
                                                .withLocalBindAddress(deviceData
                                                                        .getElementsByTagName("ip")
                                                                        .item(0).getTextContent())
                                                .withBroadcast("192.168.1.255",24)
                                                .build();
    transport[localDeviceID] = new DefaultTransport(network[localDeviceID]);
    transport[localDeviceID].setTimeout(500000);
    transport[localDeviceID].setSegTimeout(15000);
    
    localDeviceHashMap.put(localDeviceID,new LocalDevice(localDeviceID, transport[localDeviceID]));
    localDeviceHashMap.get(localDeviceID).initialize();
    

    No exceptions or errors are generated, but when enabling logging, WhoIsRouter is always sent. When not using localBindAddress and only one device two NPDUs are received. When using it nothing happens after the WhoIsRouter.

    Any help would be greatly appreciated.

    posted in BACnet4J general discussion read more
  • S
    STAstefan

    Hi,
    The problem seemed to be the fact that I tried (for test purposes) to run both YABE and my application on the same machine. Running it on two different machines in the network does the trick.

    posted in BACnet4J general discussion read more
  • S
    STAstefan

    Hello,

    I am trying to generate a local device and read it in YABE.
    The java application is a simple example of a NetworkBuilder and a local device.
    YABE is able to discover the device but when trying to read it i get the following error message:
    ERROR_CODE_REJECT_UNRECOGNIZED_SERVICE

    and the YABE log prints:
    ERVICE_CONFIRMED_READ_PROPERTY Error

    Here is my code:

    network = new IpNetworkBuilder().withPort(0xBAC5).withBroadcast("255.255.255.255",255).withReuseAddress(true).build();
            transport = new DefaultTransport(network);
            transport.setTimeout(500000);
            transport.setSegTimeout(15000);
    
            LocalDevice local = new LocalDevice(1, transport);
    
            try
            {
                local.initialize();
            }catch (Exception e)
            {
    
            }
    

    Any help would be greatly appreciated.

    posted in BACnet4J general discussion read more