This is an automated email from the ASF dual-hosted git repository.

sruehl pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-plc4x.git


The following commit(s) were added to refs/heads/master by this push:
     new 94e85f0  using local ams ports base of 30000 and increment them ever 
generation
94e85f0 is described below

commit 94e85f04233cc9a6f0beb893eee751b3f64cf49e
Author: Sebastian Rühl <sru...@apache.org>
AuthorDate: Thu May 17 17:05:30 2018 +0200

    using local ams ports base of 30000 and increment them ever generation
---
 .../org/apache/plc4x/java/ads/connection/AdsTcpPlcConnection.java    | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git 
a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/connection/AdsTcpPlcConnection.java
 
b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/connection/AdsTcpPlcConnection.java
index 5cc69a6..825fed1 100644
--- 
a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/connection/AdsTcpPlcConnection.java
+++ 
b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/connection/AdsTcpPlcConnection.java
@@ -34,11 +34,14 @@ import java.net.Inet4Address;
 import java.net.InetAddress;
 import java.net.UnknownHostException;
 import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.atomic.AtomicInteger;
 
 public class AdsTcpPlcConnection extends AdsAbstractPlcConnection {
 
     private static final int TCP_PORT = 48898;
 
+    private static AtomicInteger localPorts = new AtomicInteger(30000);
+
     private AdsTcpPlcConnection(InetAddress address, AmsNetId targetAmsNetId, 
AmsPort targetAmsPort) {
         this(address, targetAmsNetId, targetAmsPort, generateAMSNetId(), 
generateAMSPort());
     }
@@ -98,7 +101,7 @@ public class AdsTcpPlcConnection extends 
AdsAbstractPlcConnection {
     }
 
     protected static AmsPort generateAMSPort() {
-        return AmsPort.of(TCP_PORT);
+        return AmsPort.of(localPorts.getAndIncrement());
     }
 
 }

-- 
To stop receiving notification emails like this one, please contact
sru...@apache.org.

Reply via email to