Hi Chris, Hi Stefano, Thanks a lot for your valuable feedback. It is highly appreciated.
I followed Stefanos suggestions and applied the simplifications. In addition I created a Wireshark capture which is attached to this email. It seems it replies with “[Error code: This service is not implemented on the module or a frame error was reported (0x8104)]" Does this mean the address is wrong or is it something else? Best regards, Sebastian
> On 31. Aug 2020, at 09:42, Stefano Bossi <stefano.bo...@gmail.com> wrote: > > Hi Sebastian, > > if you need some help in setup the wireshark capture software or open the > jira ticket I could help. > > It’s definitely worth to follow the Chris suggestion to help him to spot the > real problem. > > In the mean time I think you could simplify the PLC query in this way: > > String Url: s7:tcp://172.3.4.5:102?controller-type=S7_1200 > > String field: %DB20:5.0:BOOL > > As far as the address of the Data Block and the bool value are correct, > should work. > There were nothing particular wrong in your query but the library is somewhat > “sensible” if something goes wrong in the dialogue with the PLC > > An another thing you should pay attention is that the Data Block MUST be NOT > optimized; reading of optimized block is not currently supported. This > shouldn’t be your case because an attempt to read an optimized block raise an > exception or a null value. > > Try and let us know. > > Regards, > Stefano > > On 31/08/2020 08:48, Christofer Dutz wrote: > > > >> Hi Sebastian, >> >> could you possibly do a wireshark recording of this, create an issue in our >> jira and attach the capture there? >> I am sure we haven't handled all things that could go wrong and with this >> information I might be able to improve the error handling. >> >> Chris >> >> >> >> >> Am 30.08.20, 18:28 schrieb "Sebastian Voss" >> <svdevl...@gmail.com> >> : >> >> Hi, >> >> I’m trying to read a value from an Siemens S7-1200 PLC). This is my >> first project using the S7 protocol and plc4x. When I try to read a value >> the read request is not being executed (I also do not receive an error >> message or timeout). Would this be the normal behaviour when the field >> address is wrong? I’m out of ideas how to trace this down. Any hints would >> be highly appreciated. >> >> This is the simple program I created: >> >> String url = >> "s7://172.3.4.5:102?local-rack=0&local-slot=1&remote-rack=0&remote-slot=1&controller-type=S7_1200 >> >> <s7://172.3.4.5:102?local-rack=0&local-slot=1&remote-rack=0&remote-slot=1&controller-type=S7_1200>"; >> PlcDriverManager manager = new PlcDriverManager(); >> PlcConnection connection = manager.getConnection(url); >> >> boolean isConnected = connection.isConnected(); >> boolean canRead = connection.getMetadata().canRead(); >> >> System.out.println(isConnected); // prints true >> System.out.println(canRead); // prints true >> >> String field = "%DB20:DBX05.0:BOOL"; >> PlcReadRequest request = connection >> .readRequestBuilder() >> .addItem("value-1", field) >> .build(); >> >> PlcReadResponse response = request.execute().get(); // here is hangs >> forever >> >> System.out.println(response.getFieldNames()); >> >> connection.close(); >> >> Thanks a lot in advance! >> >> Best regards, >> Sebastian >> >> > >