This is an automated email from the ASF dual-hosted git repository.
chrisdutz pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/plc4x.git
The following commit(s) were added to refs/heads/develop by this push:
new e7264cf6c8 fix(plc4j/ads): connect handshake honors configured AMS
ports instead of hardcoded RUNTIME_SYSTEM_01 (851) (#2630)
e7264cf6c8 is described below
commit e7264cf6c8d6a3391d362b43faa0a659f802fd36
Author: sole <[email protected]>
AuthorDate: Wed Jul 8 18:16:24 2026 +0200
fix(plc4j/ads): connect handshake honors configured AMS ports instead of
hardcoded RUNTIME_SYSTEM_01 (851) (#2630)
Co-authored-by: Dominik Solenicki <[email protected]>
---
.../java/org/apache/plc4x/java/ads/AdsTcpConnection.java | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git
a/plc4j/drivers/ads/src/main/java/org/apache/plc4x/java/ads/AdsTcpConnection.java
b/plc4j/drivers/ads/src/main/java/org/apache/plc4x/java/ads/AdsTcpConnection.java
index c58495411c..c6a6032d00 100644
---
a/plc4j/drivers/ads/src/main/java/org/apache/plc4x/java/ads/AdsTcpConnection.java
+++
b/plc4j/drivers/ads/src/main/java/org/apache/plc4x/java/ads/AdsTcpConnection.java
@@ -190,8 +190,8 @@ public class AdsTcpConnection extends
ConnectionBase<AdsConfiguration> {
private CompletableFuture<Void> doConnectHandshake() {
// ReadDeviceInfo
AmsPacket readDeviceInfoRequest = new AdsReadDeviceInfoRequest(
- getConfiguration().getTargetAmsNetId(),
DefaultAmsPorts.RUNTIME_SYSTEM_01.getValue(),
- getConfiguration().getSourceAmsNetId(), 800, ReturnCode.OK,
getInvokeId());
+ getConfiguration().getTargetAmsNetId(),
getConfiguration().getTargetAmsPort(),
+ getConfiguration().getSourceAmsNetId(),
getConfiguration().getSourceAmsPort(), ReturnCode.OK, getInvokeId());
return sendAmsRequest(readDeviceInfoRequest,
AdsReadDeviceInfoResponse.class).thenCompose(readDeviceInfoResponse -> {
if (readDeviceInfoResponse.getResult() != ReturnCode.OK) {
@@ -204,8 +204,8 @@ public class AdsTcpConnection extends
ConnectionBase<AdsConfiguration> {
// Read online version (sym-by-name
"TwinCAT_SystemInfoVarList._AppInfo.OnlineChangeCnt")
AmsPacket readOnlineVersionRequest = new AdsReadWriteRequest(
- getConfiguration().getTargetAmsNetId(),
DefaultAmsPorts.RUNTIME_SYSTEM_01.getValue(),
- getConfiguration().getSourceAmsNetId(), 800, ReturnCode.OK,
getInvokeId(),
+ getConfiguration().getTargetAmsNetId(),
getConfiguration().getTargetAmsPort(),
+ getConfiguration().getSourceAmsNetId(),
getConfiguration().getSourceAmsPort(), ReturnCode.OK, getInvokeId(),
ReservedIndexGroups.ADSIGRP_SYM_VALBYNAME.getValue(), 0L, 4L,
null,
"TwinCAT_SystemInfoVarList._AppInfo.OnlineChangeCnt".getBytes(StandardCharsets.UTF_8));
return sendAmsRequest(readOnlineVersionRequest,
AdsReadWriteResponse.class);
@@ -223,8 +223,8 @@ public class AdsTcpConnection extends
ConnectionBase<AdsConfiguration> {
}
// Read symbol version (Group 0xF008, Offset 0, length 1)
AmsPacket readSymbolVersionRequest = new AdsReadRequest(
- getConfiguration().getTargetAmsNetId(),
DefaultAmsPorts.RUNTIME_SYSTEM_01.getValue(),
- getConfiguration().getSourceAmsNetId(), 800, ReturnCode.OK,
getInvokeId(),
+ getConfiguration().getTargetAmsNetId(),
getConfiguration().getTargetAmsPort(),
+ getConfiguration().getSourceAmsNetId(),
getConfiguration().getSourceAmsPort(), ReturnCode.OK, getInvokeId(),
ReservedIndexGroups.ADSIGRP_SYM_VERSION.getValue(), 0L, 1L);
return sendAmsRequest(readSymbolVersionRequest,
AdsReadResponse.class);
}).thenCompose(readSymbolVersionResponse -> {
@@ -470,8 +470,8 @@ public class AdsTcpConnection extends
ConnectionBase<AdsConfiguration> {
@Override
protected CompletableFuture<PlcPingResponse> onPing(PlcPingRequest
pingRequest) {
AmsPacket pingPacket = new AdsReadDeviceInfoRequest(
- getConfiguration().getTargetAmsNetId(),
DefaultAmsPorts.RUNTIME_SYSTEM_01.getValue(),
- getConfiguration().getSourceAmsNetId(), 800, ReturnCode.OK,
getInvokeId());
+ getConfiguration().getTargetAmsNetId(),
getConfiguration().getTargetAmsPort(),
+ getConfiguration().getSourceAmsNetId(),
getConfiguration().getSourceAmsPort(), ReturnCode.OK, getInvokeId());
return sendAmsRequest(pingPacket, AdsReadDeviceInfoResponse.class)
.thenApply(r -> (PlcPingResponse) new
DefaultPlcPingResponse(pingRequest, PlcResponseCode.OK));
}