What is the motivation for using MulticastSocket instead a plain DatagramSocket? I assume it is to add multicasting as an alternative to BBMD. In this case your code is not complete and requires a lot of refactoring in Bacnet4J!
To receive data from a MulticastSocket, you must first join a multicast group. The group must be in range from 224.0.0.0 to 239.255.255.255, inclusive. The address 224.0.0.0 is reserved and should not be used. If the address that you try to join is not a multicast address, the joinGroup( ) method throws an IOException. The parameter multicastGroupAddress should be passed to the IpNetwork constructor or NetworkBuilder in case the user is going to configure multicasting.
exclusiveSocket = new MulticastSocket(localBindAddressStr);
InetAddress group=InetAddress.getByName(multicastGroupAddress);
socket.joinGroup(group);
The MulticastSocket class adds an overloaded variant of the send( ) method that lets you provide a value for the Time-To-Live field ttl. By default, the send( ) method uses a TTL of 1 and such packets are dropped by routers like other UDP packets (when a packet is received on a router interface, one of the very first things that happens is decrementing the TTL. If the TTL is 0 at this point, the router drops the packet with no further processing. This is a very low-level process and occurs before any other kind of packet processing takes place). Only multicast packets with a TTL greater than the 1 are forwarded. Sending packets via old Bacnet4J send() method means, that packets don't travel outside the local subnet and multicasting is unusable.
Multicast generally makes the configuration of a Bacnet network very complicated.
You cannot have simultaneous devices configured for broadcast and multicast on the same network segment.
Multicast is generally considered to be a low-security type of communication (basically, it is never clear who is receiving the packets sent) and therefore many site administrators prohibit multicast.
Personally, I would see the proper implementation of BBMD and FDT in Bacnet4J rather than multicast.
What is the motivation for using MulticastSocket instead a plain DatagramSocket? I assume it is to add
multicasting
as an alternative to BBMD. In this case your code is not complete and requires a lot of refactoring in Bacnet4J!MulticastSocket
, you must first join a multicast group. The group must be in range from 224.0.0.0 to 239.255.255.255, inclusive. The address 224.0.0.0 is reserved and should not be used. If the address that you try to join is not a multicast address, the joinGroup( ) method throws an IOException. The parametermulticastGroupAddress
should be passed to the IpNetwork constructor or NetworkBuilder in case the user is going to configure multicasting.MulticastSocket
class adds an overloaded variant of thesend( )
method that lets you provide a value for the Time-To-Live fieldttl
. By default, thesend( )
method uses a TTL of 1 and such packets are dropped by routers like other UDP packets (when a packet is received on a router interface, one of the very first things that happens is decrementing the TTL. If the TTL is 0 at this point, the router drops the packet with no further processing. This is a very low-level process and occurs before any other kind of packet processing takes place). Only multicast packets with a TTL greater than the 1 are forwarded. Sending packets via old Bacnet4Jsend()
method means, that packets don't travel outside the local subnet and multicasting is unusable.Multicast generally makes the configuration of a Bacnet network very complicated.
You cannot have simultaneous devices configured for broadcast and multicast on the same network segment.
Multicast is generally considered to be a low-security type of communication (basically, it is never clear who is receiving the packets sent) and therefore many site administrators prohibit multicast.
Personally, I would see the proper implementation of BBMD and FDT in Bacnet4J rather than multicast.