Hi all,

I need to write a STRING to a Beckhoff. What would be the way to do it ?
NOTE: Reading works.

I tried this and it fails:

    public static void main( String[] args ) throws PlcConnectionException, 
InterruptedException, ExecutionException
    {
        PlcDriverManager driver = new PlcDriverManager();
        //PlcConnection connection = 
driver.getConnection("eip://10.127.17.10?backplane=1&slot=0");
        PlcConnection connection = 
driver.getConnection("ads:tcp://10.10.11.77?sourceAmsNetId=172.29.48.1.1.1&sourceAmsPort=27&targetAmsNetId=5.62.206.200.1.1&targetAmsPort=851");

        PlcWriteRequest writeRequest = connection.writeRequestBuilder()
                                                 
.addItem("MAIN.Patrick:STRING", "MAIN.Patrick:STRING", "Patrick")
                                                 .build();

         writeRequest.execute().get();
         System.out.println("WRITE DONE" );
    }

Exception in thread "main" java.util.concurrent.ExecutionException: 
org.apache.plc4x.java.api.exceptions.PlcException: Error
        at 
java.base/java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:396)
        at 
java.base/java.util.concurrent.CompletableFuture.get(CompletableFuture.java:2073)
        at demo.App.main(App.java:64)
Caused by: org.apache.plc4x.java.api.exceptions.PlcException: Error
        at 
org.apache.plc4x.java.ads.protocol.AdsProtocolLogic.singleWrite(AdsProtocolLogic.java:461)
        at 
org.apache.plc4x.java.ads.protocol.AdsProtocolLogic.executeWrite(AdsProtocolLogic.java:406)
        at 
org.apache.plc4x.java.ads.protocol.AdsProtocolLogic.write(AdsProtocolLogic.java:364)
        at 
org.apache.plc4x.java.spi.connection.AbstractPlcConnection.write(AbstractPlcConnection.java:161)
        at 
org.apache.plc4x.java.spi.messages.DefaultPlcWriteRequest.execute(DefaultPlcWriteRequest.java:65)

Thanks again four your help and support.
Best regards

Patrick Boisclair
Analyste - Programmeur senior
Senior Analyst Programmer
noovelia.com

Reply via email to