Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use shared socket for IpNetwork #88

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft

Use shared socket for IpNetwork #88

wants to merge 1 commit into from

Conversation

MertCingoz
Copy link
Member

No description provided.

@envas
Copy link

envas commented Nov 23, 2023

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!

  1. 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);
  1. 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.

  1. You cannot have simultaneous devices configured for broadcast and multicast on the same network segment.

  2. 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants