ty very much for yout input. Ill test it out !
Note that: I cant seem to be able to use "0.8-SNAPSHOT" or "0.8.0-SNAPSHOT" Could not find org.apache.plc4x:plc4j-api:0.8-SNAPSHOT. Searched in the following locations: - https://repo.maven.apache.org/maven2/org/apache/plc4x/plc4j-api/0.8-SNAPSHOT/maven-metadata.xml - https://repo.maven.apache.org/maven2/org/apache/plc4x/plc4j-api/0.8-SNAPSHOT/plc4j-api-0.8-SNAPSHOT.pom Required by: Patrick Boisclair Analyste - Programmeur senior / Senior Analyst Programmer [cid:image192cb4.PNG@b34caf2c.41950a49]<https://www.noovelia.com> 462, rue des Forges, Trois-Rivières (Québec) G9A 2H5 CANADA noovelia.com<https://www.noovelia.com> [cid:image7dc0c4.PNG@5ceacdff.459b01ab] "Veuillez noter ma nouvelle adresse courriel. / Please note my new email address." ________________________________ De : Ben Hutcheson <hutc...@apache.org> Envoyé : 4 décembre 2020 20:06 À : dev@plc4x.apache.org Objet : Re: ADS Driver: org.apache.plc4x.java.api.exceptions.PlcRuntimeException: java.util.concurrent.TimeoutException 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> [https://www.noovelia.com/_media/image/342/noovelia-og-image-v2.jpg]<https://www.noovelia.com/> Noovelia - Business management software and process automation<https://www.noovelia.com/> www.noovelia.com Digitize, automate and connect your systems and equipment to increase business efficiency: optimal logistics, production and inventory management. > > > 462, rue des Forges, Trois-Rivières (Québec) G9A 2H5 CANADA > noovelia.com <https://www.noovelia.com> [https://www.noovelia.com/_media/image/342/noovelia-og-image-v2.jpg]<https://www.noovelia.com/> Noovelia - Business management software and process automation<https://www.noovelia.com/> www.noovelia.com Digitize, automate and connect your systems and equipment to increase business efficiency: optimal logistics, production and inventory management. > > > > > *"Veuillez noter ma nouvelle adresse courriel. / Please note my new email > address." * >