Re: s7URIPattern doesn't match

2020-07-22 Thread Lukas Ott
Hi Gerado,

Go to: https://issues.apache.org/jira/projects/PLC4X/summary and create an
account with your mail address. Login and then you can create an issue in
our jira.

Thank you for supporting our project. :)

Kind regards
Lukas

Am Mi., 22. Juli 2020 um 19:17 Uhr schrieb Gerardo Melia <
gerame...@gmail.com>:

> Hi  Julian, thanks for the reply. I'm not sure about how to open an issue.
> Sorry :(
>
> On Mon, 20 Jul 2020 at 17:00, Julian Feinauer <
> j.feina...@pragmaticminds.de>
> wrote:
>
> > Hi Gerardo,
> >
> > Thanks for your mail!
> > This indeed is a bug as far as I see it.
> >
> > Would you mind opening an issue for it?
> > I will try to fix it tomorrow.
> >
> > Thanks!
> > Julian
> >
> > Holen Sie sich Outlook für Android
> >
> > 
> > From: Gerardo Melia 
> > Sent: Monday, July 20, 2020 5:02:58 PM
> > To: dev@plc4x.apache.org 
> > Subject: s7URIPattern doesn't match
> >
> > Hi people, first of all thanks for the amazing project that you are
> doing.
> > I have an issue with the 0.7.0 version when I'm using S7 driver. The
> regex
> > of the pattern doesn't match so I got this error: Caused by:
> > java.lang.IllegalArgumentException: s7://192.168.1.200/0/1<
> > http://192.168.1.200/0/1> doesn't match
> >
> >
> >
> >
> https://github.com/apache/plc4x/blob/1e6df7563ad909d365d1402729699b61c70019bd/plc4j/tools/connection-pool/src/main/java/org/apache/plc4x/java/utils/connectionpool/PoolKeyFactory.java#L46
> >
> > [image.png]
> >
> > This regex is correct but In version 0.7.0 I found this one in
> > PoolKeyFactory class:
> >
> > private final Pattern s7URIPattern =
> >
> Pattern.compile("^(?s7://((?[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3})|(?[a-zA-Z0-9\\.\\-]+))(:(?[0-9]{1,5}))?)(?\\?.*)?");
> >
> > that doesn't match : s7://192.168.1.200/0/1 (With
> > no rack nor slot)
> >
> > Do you know if there is an issue here?
> >
> > Thanks in advance.
> >
> > Gerardo Melia
> >
> >
>


Re: s7URIPattern doesn't match

2020-07-22 Thread Gerardo Melia
Hi  Julian, thanks for the reply. I'm not sure about how to open an issue.
Sorry :(

On Mon, 20 Jul 2020 at 17:00, Julian Feinauer 
wrote:

> Hi Gerardo,
>
> Thanks for your mail!
> This indeed is a bug as far as I see it.
>
> Would you mind opening an issue for it?
> I will try to fix it tomorrow.
>
> Thanks!
> Julian
>
> Holen Sie sich Outlook für Android
>
> 
> From: Gerardo Melia 
> Sent: Monday, July 20, 2020 5:02:58 PM
> To: dev@plc4x.apache.org 
> Subject: s7URIPattern doesn't match
>
> Hi people, first of all thanks for the amazing project that you are doing.
> I have an issue with the 0.7.0 version when I'm using S7 driver. The regex
> of the pattern doesn't match so I got this error: Caused by:
> java.lang.IllegalArgumentException: s7://192.168.1.200/0/1<
> http://192.168.1.200/0/1> doesn't match
>
>
>
> https://github.com/apache/plc4x/blob/1e6df7563ad909d365d1402729699b61c70019bd/plc4j/tools/connection-pool/src/main/java/org/apache/plc4x/java/utils/connectionpool/PoolKeyFactory.java#L46
>
> [image.png]
>
> This regex is correct but In version 0.7.0 I found this one in
> PoolKeyFactory class:
>
> private final Pattern s7URIPattern =
> Pattern.compile("^(?s7://((?[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3})|(?[a-zA-Z0-9\\.\\-]+))(:(?[0-9]{1,5}))?)(?\\?.*)?");
>
> that doesn't match : s7://192.168.1.200/0/1 (With
> no rack nor slot)
>
> Do you know if there is an issue here?
>
> Thanks in advance.
>
> Gerardo Melia
>
>


Re: Connection died after disconnection

2020-07-22 Thread Stefano Bossi
Ok,

thanks for the fast reply, I will check the documentation and I will let
you know.

Regards,
S.


On 21/07/2020 19:21, Christofer Dutz wrote:
> Hi Stefano,
>
> First of all, welcome on our list... We'll do our best to help you.
>
> Have you tried using our connection pool? Cause this should handle the 
> connection state if the connection is disturbed. Also the scraper is a tool 
> for collecting data periodically. This in combination with the connection 
> pool should be what you are looking for.
>
> Please find the documentation to using both on our website.
>
> Hope that helps,
> Chris
> 
> Von: Stefano Bossi 
> Gesendet: Dienstag, 21. Juli 2020 15:56
> An: Apache PLC4X 
> Betreff: Connection died after disconnection
>
>
> Dear forum,
>
> I am trying to develop a simple poller for my S7 PLC ST_1200.
> I need just a simple thread in java which read a value and report it, anyway 
> this must be robust to any problem on the network.
> I mean I would like to cope with these situation:
>
>   *   PLC not responding;
>   *   network issues;
>
> The software should normally read a value from the plc in 200 ms and if 
> something bad happen, wait for 5 second and retry to read in a normal way.
>
> I wrote some code but when I found a problem.
> This is my code:
>
> public void run() {
> ConfigurationDataProvider configurationDataProvider = 
> ConfigurationDataProvider.getInstance();
> try {
> PlcConnection plcConnection = new 
> Client().getClient(configurationDataProvider.getPlcConnectionString()).getPlcConnection();
> PlcReadRequest.Builder requestBuilder = 
> plcConnection.readRequestBuilder();
> requestBuilder.addItem("pollingVariable", 
> configurationDataProvider.getPlcPollingVariable());
> PlcReadRequest readRequest = requestBuilder.build();
> while (true){
> if (plcConnection.isConnected()){
> try {
> PlcReadResponse response = 
> readRequest.execute().get(CONNECTION_TIME_OUT, TimeUnit.MILLISECONDS);
> if (response != null ){
> logger.debug("Polling variable: {}", 
> response.getPlcValue("pollingVariable"));
> } else {
> logger.error("No response from PLC in reading 
> polling variable");
> break;
> }
> } catch (TimeoutException timeoutException){
> logger.error("Time out Exception in polling PLC", 
> timeoutException);
> Thread.sleep(5000);
> }
> 
> Thread.sleep(configurationDataProvider.getPollingInterval());
> }
> }
>
> } catch (Exception e) {
> logger.error("Interrupted Exception", e);
> }
> }
>
>
> When I try to disconnect the cable, netty comply with an internal error and 
> my application dies without a way to recover.
> Here are the logs:
>
> [ERROR] 15:33:38.830 it.fox.plcreader.Poller.run() - Time out Exception in 
> polling PLC
> java.util.concurrent.TimeoutException: null
> at java.util.concurrent.CompletableFuture.timedGet(Unknown Source) ~[?:?]
> at java.util.concurrent.CompletableFuture.get(Unknown Source) ~[?:?]
> at it.fox.plcreader.Poller.run(Poller.java:34) [main/:?]
> Poller.java:34
> at java.lang.Thread.run(Unknown Source) [?:?]
> [ERROR] 15:33:49.333 it.fox.plcreader.Poller.run() - Time out Exception in 
> polling PLC
> java.util.concurrent.TimeoutException: null
> at java.util.concurrent.CompletableFuture.timedGet(Unknown Source) ~[?:?]
> at java.util.concurrent.CompletableFuture.get(Unknown Source) ~[?:?]
> at it.fox.plcreader.Poller.run(Poller.java:34) [main/:?]
> Poller.java:34
> at java.lang.Thread.run(Unknown Source) [?:?]
> [WARN ] 15:33:54.308 
> io.netty.channel.DefaultChannelPipeline.onUnhandledInboundException() - An 
> exceptionCaught() event was fired, and it reached at the tail of the 
> pipeline. It usually means the last handler in the pipeline did not handle 
> the exception.
> java.io.IOException: Operation timed out
> at sun.nio.ch.SocketDispatcher.read0(Native Method) ~[?:?]
> at sun.nio.ch.SocketDispatcher.read(Unknown Source) ~[?:?]
> at sun.nio.ch.IOUtil.readIntoNativeBuffer(Unknown Source) ~[?:?]
> at sun.nio.ch.IOUtil.read(Unknown Source) ~[?:?]
> at sun.nio.ch.IOUtil.read(Unknown Source) ~[?:?]
> at sun.nio.ch.SocketChannelImpl.read(Unknown Source) ~[?:?]
> at io.netty.buffer.PooledByteBuf.setBytes(PooledByteBuf.java:253) 
> ~[netty-buffer-4.1.47.Final.jar:4.1.47.Final]
> PooledByteBuf.java:253
> at io.netty.buffer.AbstractByteBuf.writeBytes(AbstractByteBuf.java:1133) 
> ~[netty-buffer-4.1.47.Final.jar:4.1.47.Final]
> AbstractByteBuf.java:1133
> at 
>