Skip to content

Commit

Permalink
Add support for reuseAddress flag in BacNetIpClient.
Browse files Browse the repository at this point in the history
This switch allows to bind multiple client instances on the same port.
Closes #33.

Signed-off-by: Łukasz Dywicki <[email protected]>
  • Loading branch information
splatch committed Mar 4, 2024
1 parent 75e649e commit c3b2233
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ public BacNetIpClient(IpNetwork network, int deviceId) {
super(new LocalDevice(deviceId, new DefaultTransport(network)));
}

public BacNetIpClient(String ip, String broadcast, int port, int deviceId, boolean reuseAddress) {
this(new IpNetworkBuilder().withLocalBindAddress(ip).withBroadcast(broadcast, 24).withPort(port)
.withReuseAddress(reuseAddress).build(), deviceId);
}

public BacNetIpClient(String ip, String broadcast, int port, int deviceId) {
this(new IpNetworkBuilder().withLocalBindAddress(ip).withBroadcast(broadcast, 24).withPort(port).build(), deviceId);
}
Expand Down

0 comments on commit c3b2233

Please sign in to comment.