Skip to content

Commit c3b2233

Browse files
committed
Add support for reuseAddress flag in BacNetIpClient.
This switch allows to bind multiple client instances on the same port. Closes #33. Signed-off-by: Łukasz Dywicki <[email protected]>
1 parent 75e649e commit c3b2233

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

ip/src/main/java/org/code_house/bacnet4j/wrapper/ip/BacNetIpClient.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,11 @@ public BacNetIpClient(IpNetwork network, int deviceId) {
4444
super(new LocalDevice(deviceId, new DefaultTransport(network)));
4545
}
4646

47+
public BacNetIpClient(String ip, String broadcast, int port, int deviceId, boolean reuseAddress) {
48+
this(new IpNetworkBuilder().withLocalBindAddress(ip).withBroadcast(broadcast, 24).withPort(port)
49+
.withReuseAddress(reuseAddress).build(), deviceId);
50+
}
51+
4752
public BacNetIpClient(String ip, String broadcast, int port, int deviceId) {
4853
this(new IpNetworkBuilder().withLocalBindAddress(ip).withBroadcast(broadcast, 24).withPort(port).build(), deviceId);
4954
}

0 commit comments

Comments
 (0)