Hi Patrick, I'll offer some general PLC4X hints as I don't have any experience with the Beckoff specific stuff, in exchange for some documentation updates when you sort it out. ;)
1) Make sure you are using the latest 0.8-SNAPSHOT version and not version 0.7. 2) The line PlcReadResponse response = request.execute().get(); supports a timeout. PlcReadResponse response = request.execute().get(1000, TimeUnit.MILLISECONDS); otherwise it won't return if there is a timeout. 3) Does the error happen all the time? 4) Can you narrow down what line the error occurs? 5) Do you see any packets being sent using Wireshark? Kind Regards Ben On Fri, Dec 4, 2020 at 5:21 PM Patrick Boisclair <pboiscl...@noovelia.com> wrote: > Hello everyone, > > > Im getting this error from a connection with a Beckhoff connection (ADS). > > > org.apache.plc4x.java.api.exceptions.PlcRuntimeException: > java.util.concurrent.TimeoutException > at > org.apache.plc4x.java.ads.connection.AdsAbstractPlcConnection.getFromFuture(AdsAbstractPlcConnection.java:236) > at > org.apache.plc4x.java.ads.connection.AdsAbstractPlcConnection.lambda$mapFields$3(AdsAbstractPlcConnection.java:180) > at > java.base/java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1705) > at > org.apache.plc4x.java.ads.connection.AdsAbstractPlcConnection.mapFields(AdsAbstractPlcConnection.java:163) > > Here is the Java code: > > > public class App { > public static void main(String[] args) throws PlcConnectionException { > PlcDriverManager driver = new PlcDriverManager(); > try { > PlcConnection connection = driver.getConnection("ads:tcp:// > 10.10.11.77/5.62.206.200.1.1:851"); > if (connection.isConnected()) { > System.out.println("CONNECTED"); > if (connection.getMetadata().canRead()) { > System.out.println("CAN READ"); > > PlcReadRequest.Builder builder = connection. > readRequestBuilder(); > builder.addItem("value-1", "MAIN.Rand_1:DINT"); > > PlcReadRequest request = builder.build(); > PlcReadResponse response = request.execute().get(); > } > } > } catch (Exception e) { > e.printStackTrace(); > } > > } > } > > > > I tried with C# and the TwinCatAds.dll from beckhoff and it works. > > > public void Open() > { > try > { > tcClient.Connect("5.62.206.200.1.1", 851); > if (tcClient.IsConnected) > { > Console.WriteLine("CONNECTED"); > > BinRead = new BinaryReader(DataStream, Encoding.ASCII); > PlcVariables[0] = tcClient.AddDeviceNotification("MAIN.Rand_1", > DataStream, 0, 1, AdsTransMode.OnChange, 100, 0, null); > > tcClient.AdsNotification += new > AdsNotificationEventHandler(OnNotification); > } > } > catch (Exception ex) > { > Console.WriteLine(ex.ToString()); > } > } > > > private void OnNotification(object sender, AdsNotificationEventArgs e) > { > string strValue = string.Empty; > e.DataStream.Position = e.Offset; > if (e.NotificationHandle == PlcVariables[0]) > { > strValue = BinRead.ReadInt16().ToString(); > } > Console.WriteLine(strValue); > } > > Im new with PLC4x and the Java world also [image: ☹] > > Can anyone points me what I miss or doing wrong ? > > > > > Patrick Boisclair > Analyste - Programmeur senior / Senior Analyst Programmer > > <https://www.noovelia.com> > > > 462, rue des Forges, Trois-Rivières (Québec) G9A 2H5 CANADA > noovelia.com <https://www.noovelia.com> > > > > > *"Veuillez noter ma nouvelle adresse courriel. / Please note my new email > address." * >