You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@plc4x.apache.org by "Christofer Dutz (Jira)" <ji...@apache.org> on 2021/01/25 08:00:00 UTC
[jira] [Resolved] (PLC4X-188) Connection doesn't close
[ https://issues.apache.org/jira/browse/PLC4X-188?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Christofer Dutz resolved PLC4X-188.
-----------------------------------
Resolution: Fixed
> Connection doesn't close
> ------------------------
>
> Key: PLC4X-188
> URL: https://issues.apache.org/jira/browse/PLC4X-188
> Project: Apache PLC4X
> Issue Type: Bug
> Components: Driver-Modbus
> Affects Versions: 0.6.0
> Reporter: T. Langhorst
> Priority: Major
>
> I use the following code:
> {code:java}
> String connectionString = "modbus:tcp://localhost:502";
> try(PlcConnection connection = new PlcDriverManager().getConnection(connectionString)) {
> if (!connection.getMetadata().canRead()) {
> System.out.println("This connection doesn't support reading.");
> return;
> }
> PlcReadRequest request = connection.readRequestBuilder()
> .addItem("c1", "coil:1")
> .build();
> PlcReadResponse resp = request.execute().get();
> boolean coil = resp.getBoolean("c1");
> System.out.println("Status of coil 1: " + coil);
> } catch (InterruptedException | ExecutionException | PlcConnectionException e) {
> e.printStackTrace();
> }
> {code}
> But the program just doesn't exit after the request is finished.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)