You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@plc4x.apache.org by Sebastian Wiendl <SW...@bhs-corrugated.de> on 2019/11/07 13:57:09 UTC

Configuring a S7-1500 for Access with PLC4J

Hello everyone,

my sample program of PLC4J (very similiar to the hello world example) 
fails to connect to my test PLC (S7-1500):

Nov 07, 2019 2:37:51 PM io.netty.channel.DefaultChannelPipeline 
onUnhandledInboundException
WARNUNG: 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: Eine vorhandene Verbindung wurde vom Remotehost 
geschlossen
        at sun.nio.ch.SocketDispatcher.read0(Native Method)
        at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:43)
        at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:223)
        at sun.nio.ch.IOUtil.read(IOUtil.java:192)
        at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:380)
        at 
io.netty.buffer.PooledUnsafeDirectByteBuf.setBytes(PooledUnsafeDirectByteBuf.java:288)
        at 
io.netty.buffer.AbstractByteBuf.writeBytes(AbstractByteBuf.java:1125)
        at 
io.netty.channel.socket.nio.NioSocketChannel.doReadBytes(NioSocketChannel.java:347)
        at 
io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:148)
        at 
io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:682)
        at 
io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:617)
        at 
io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:534)
        at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:496)
        at 
io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:906)
        at 
io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
        at 
io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
        at java.lang.Thread.run(Thread.java:748)

"An existing connection was closed by the remote host"

Thats my program at the moment:


    public static void main(String[] args) {
        try (PlcConnection plcConnection = new 
PlcDriverManager().getConnection("s7://172.30.74.65/0/2")) {
            System.out.println("connected");
            System.out.println(plcConnection);
            CompletableFuture<Void> ping = plcConnection.ping();
            ping.get(500, TimeUnit.MILLISECONDS);
            System.out.println("ping exception = " + 
ping.isCompletedExceptionally());
        } catch (Exception e) {
            e.printStackTrace();
        }
        System.out.println("disconnected");
    }

I can both ping the PLC as well as connect to it with the Siemens TIA 
Portal. Does the PLC need some special configuration in the project to be 
reachable via S7Comm via ISO on TCP? nmap shows port 102 TCP as open.

Any help is much appreciated!

Mit freundlichen Grüßen
Kind regards

Sebastian Wiendl
DSE / Digital Solutions Software Engineer
Phone: +49 9605 919 - 9341
E-Mail: SWiendl@bhs-world.com
Internet: www.bhs-world.com
Shop: www.icorr.shop

 

BHS Corrugated Maschinen- und Anlagenbau GmbH
Paul-Engel-Straße 1
92729 WEIHERHAMMER
GERMANY

Management: Christian Engel, Lars Engel
Registered at Amtsgericht Weiden, HR B 1320








Re: Antwort: Re: Antwort: Re: Configuring a S7-1500 for Access with PLC4J

Posted by Christofer Dutz <ch...@c-ware.de>.
Regarding the TIA protocol ...

We probably won't be able to provide an active driver for TIA, however I will start working on a passive mode version pretty soon. 
With this we can at least intercept the traffic and read it.
Perhaps one day we'll find out how to also be able to provide active versions.

Regarding the hang-ups ... could you possibly do a Wireshark capture of what's happening when you execute your program and attach that to an issue?


Chris



Am 08.11.19, 13:03 schrieb "Julian Feinauer" <j....@pragmaticminds.de>:

    Hi Sebastian,
    
    thanks fort he response, good to hear that it works now.
    The stacktrace that you show could be related to the disconnect, indeed.
    I remember that it was a bit tricky to get it right and if you would create a Jira I can try to look into it.
    
    To your question regarding S7CommPlus (optimized datablocks):
    We currently cannot but there is a long discussion around this topic (I would like it too).
    The main issue is that we would need to reverse engineer some part of the TIA Libraries to extract private keys of a cryptographic challenge that is done during initial handshake which is illegal in Germany (“Hackerparagraph”).
    
    But we are on the topic and have ideas for other ways around it as it would be really good to have this feature.
    
    Julian
    
    Von: Sebastian Wiendl <SW...@bhs-corrugated.de>
    Antworten an: "dev@plc4x.apache.org" <de...@plc4x.apache.org>
    Datum: Freitag, 8. November 2019 um 12:55
    An: "dev@plc4x.apache.org" <de...@plc4x.apache.org>
    Betreff: Antwort: Re: Antwort: Re: Configuring a S7-1500 for Access with PLC4J
    
    Hi all,
    
    news from my side: The logged exception happens during the disconnect phase. Connecting, pinging and reading values works just fine. Fun Fact: The communication works regardless of the specified rack/slot.
    
    This is my updated program:
    
    
    public static void main(String[] args) {
       try (PlcConnection plcConnection = new PlcDriverManager().getConnection("s7://172.30.74.65/0/0")) {
           System.out.println("connected");
           System.out.println(plcConnection);
           CompletableFuture<Void> ping = plcConnection.ping();
           ping.get(500, TimeUnit.MILLISECONDS);
           System.out.println("ping exception = " + ping.isCompletedExceptionally());
    
           // non optimized DB
           for (int i = 0; i < 3; i++) {
               PlcReadRequest.Builder builder = plcConnection.readRequestBuilder();
               final String fieldName = "field";
               builder.addItem(fieldName, "%DB101.DBW78:INT");
               PlcReadRequest readRequest = builder.build();
               LocalDateTime start = now();
               PlcReadResponse plcReadResponse = readRequest.execute().get();
               System.out.println("request took " + Duration.between(start, now()));
               System.out.println(fieldName + " response: " + plcReadResponse.getResponseCode(fieldName) + "; value: " + plcReadResponse.getInteger(fieldName));
           }
    
           try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
               br.readLine();
           }
       } catch (Exception e) {
           e.printStackTrace();
       }
       System.out.println("disconnected");
    }
    
    The execution yields this output:
    
    SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
    SLF4J: Defaulting to no-operation (NOP) logger implementation
    SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
    connected
    org.apache.plc4x.java.s7.connection.S7PlcConnection@131276c2
    ping exception = false
    request took PT0.029S
    field response: OK; value: 2
    request took PT0.002S
    field response: OK; value: 2
    request took PT0.002S
    field response: OK; value: 2
    
    Nov 08, 2019 12:53:36 PM io.netty.channel.DefaultChannelPipeline onUnhandledInboundException
    WARNUNG: 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: Eine vorhandene Verbindung wurde vom Remotehost geschlossen
            at sun.nio.ch.SocketDispatcher.read0(Native Method)
            at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:43)
            at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:223)
            at sun.nio.ch.IOUtil.read(IOUtil.java:192)
            at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:380)
            at io.netty.buffer.PooledUnsafeDirectByteBuf.setBytes(PooledUnsafeDirectByteBuf.java:288)
            at io.netty.buffer.AbstractByteBuf.writeBytes(AbstractByteBuf.java:1125)
            at io.netty.channel.socket.nio.NioSocketChannel.doReadBytes(NioSocketChannel.java:347)
            at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:148)
            at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:682)
            at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:617)
            at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:534)
            at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:496)
            at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:906)
            at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
            at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
            at java.lang.Thread.run(Thread.java:748)
    
    disconnected
    
    The exception only shows after pressing enter, therefore during the disconnect. I think what i discovered is a non-issue. Not nice, but not stopping me.
    
    BTW does PLC4J support reading optimized S7 DBs? If not, is support for this planned at some point in time?
    
    Mit freundlichen Grüßen
    Kind regards
    
    Sebastian Wiendl
    DSE / Digital Solutions Software Engineer
    Phone: +49 9605 919 - 9341
    E-Mail: SWiendl@bhs-world.com
    Internet: www.bhs-world.com<https://www.bhs-world.com>
    Shop: www.icorr.shop
    ________________________________
     [cid:_1_15253CC8152538CC00417B1CC12584AC]
    
    BHS Corrugated Maschinen- und Anlagenbau GmbH
    Paul-Engel-Straße 1
    92729 WEIHERHAMMER
    GERMANY
    
    Management: Christian Engel, Lars Engel
    Registered at Amtsgericht Weiden, HR B 1320
    
    ________________________________
    
    [cid:_2_158FEFC0158FEE7000417B1CC12584AC]
    [cid:_2_158FF6A4158FF2C000417B1CC12584AC]
    [cid:_2_158FFC90158FF8AC00417B1CC12584AC]
    
    
    [cid:_1_1590012C158FF9FC00417B1CC12584AC]
    
    
    
    
    Von:        "Tim Mitsch" <t....@pragmaticindustries.de>
    An:        "dev@plc4x.apache.org" <de...@plc4x.apache.org>
    Datum:        07.11.2019 17:47
    Betreff:        Re: Antwort: Re: Configuring a S7-1500 for Access with PLC4J
    ________________________________
    
    
    
    Hey Sebastian
    
    Sorry for delayed answer – but first of all warm welcome on the list.
    
    Just tested ur code-snippet vs our S7-1515 and is working fine.
    U said u activated Put/Get.
    Do u have the possibility to execute the scraper runner:
    Plc4j/util/scraper/test/TriggeredScraperRunner
    
    U need to adjust the ‘example_triggered_scraper.yml’ to ur needs (ip, field) …
    Please take into account that the field to be read from must be a NON-optimized block
    
    If there are still issue please write on the list and I can make a cross-check to the S7 Settings.
    
    Best
    Tim
    
    
    
    Von: Sebastian Wiendl <SW...@bhs-corrugated.de>
    Antworten an: "dev@plc4x.apache.org" <de...@plc4x.apache.org>
    Datum: Donnerstag, 7. November 2019 um 16:29
    An: "dev@plc4x.apache.org" <de...@plc4x.apache.org>
    Betreff: Antwort: Re: Configuring a S7-1500 for Access with PLC4J
    
    Hi Cesar,
    
    thanks for your input.
    
    s7://172.30.74.65/0/0 <http://172.30.74.65/0/2> is an illegal plc4j connection string. (The PLC's webserver is disabled btw.)
    
    s7://172.30.74.65/0/0 yields the same exception as before.
    
    I checked with our IT department in parallel - there is one router between me and the PLC and port 102 is open and reachable. No firewalls either.
    
    Mit freundlichen Grüßen
    Kind regards
    
    Sebastian Wiendl
    DSE / Digital Solutions Software Engineer
    Phone: +49 9605 919 - 9341
    E-Mail: SWiendl@bhs-world.com
    Internet: www.bhs-world.com<https://www.bhs-world.com<https://www.bhs-world.com/>>
    Shop: www.icorr.shop
    ________________________________
    [cid:_1_150B9900150B9504005508A3C12584AB]
    
    BHS Corrugated Maschinen- und Anlagenbau GmbH
    Paul-Engel-Straße 1
    92729 WEIHERHAMMER
    GERMANY
    
    Management: Christian Engel, Lars Engel
    Registered at Amtsgericht Weiden, HR B 1320
    
    ________________________________
    
    [cid:_2_150BB3DC150BAFF8005508A3C12584AB]
    [cid:_2_150BB9C8150BB5E4005508A3C12584AB]
    [cid:_2_150BBFB4150BBBD0005508A3C12584AB]
    
    
    [cid:_1_150BC450150BBD20005508A3C12584AB]
    
    
    
    
    Von:        "Cesar Garcia" <ce...@ceos.com.ve>
    An:        "Apache PLC4X" <de...@plc4x.apache.org>
    Datum:        07.11.2019 15:53
    Betreff:        Re: Configuring a S7-1500 for Access with PLC4J
    ________________________________
    
    
    
    Hello,
    
    Try (*"s7://172.30.74.65/0/0 <http://172.30.74.65/0/2>")*
    
    For S7-1200 and S7-1500 is Rack=0, Slot=0,
    
    Best regards
    
    El jue., 7 nov. 2019 a las 9:58, Sebastian Wiendl (<
    SWiendl@bhs-corrugated.de>) escribió:
    
    > Hello everyone,
    >
    > my sample program of PLC4J (very similiar to the hello world example)
    > fails to connect to my test PLC (S7-1500):
    >
    > Nov 07, 2019 2:37:51 PM io.netty.channel.DefaultChannelPipeline
    > onUnhandledInboundException
    > WARNUNG: 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: Eine vorhandene Verbindung wurde vom Remotehost
    > geschlossen
    >         at sun.nio.ch.SocketDispatcher.read0(Native Method)
    >         at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:43)
    >         at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:223)
    >         at sun.nio.ch.IOUtil.read(IOUtil.java:192)
    >         at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:380)
    >         at
    > io.netty.buffer.PooledUnsafeDirectByteBuf.setBytes(PooledUnsafeDirectByteBuf.java:288)
    >         at
    > io.netty.buffer.AbstractByteBuf.writeBytes(AbstractByteBuf.java:1125)
    >         at
    > io.netty.channel.socket.nio.NioSocketChannel.doReadBytes(NioSocketChannel.java:347)
    >         at
    > io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:148)
    >         at
    > io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:682)
    >         at
    > io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:617)
    >         at
    > io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:534)
    >         at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:496)
    >         at
    > io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:906)
    >         at
    > io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
    >         at
    > io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
    >         at java.lang.Thread.run(Thread.java:748)
    >
    > "An existing connection was closed by the remote host"
    >
    > Thats my program at the moment:
    >
    >
    >     *public static void *main(String[] args) {
    >        *try *(PlcConnection plcConnection = *new *
    > PlcDriverManager().getConnection(*"s7://172.30.74.65/0/2
    > <http://172.30.74.65/0/2>"*)) {
    >            System.*out*.println(*"connected"*);
    >            System.*out*.println(plcConnection);
    >            CompletableFuture<Void> ping = plcConnection.ping();
    >            ping.get(500, TimeUnit.*MILLISECONDS*);
    >            System.*out*.println(*"ping exception = " *+
    > ping.isCompletedExceptionally());
    >        } *catch *(Exception e) {
    >            e.printStackTrace();
    >        }
    >        System.*out*.println(*"disconnected"*);
    >    }
    >
    > I can both ping the PLC as well as connect to it with the Siemens TIA
    > Portal. Does the PLC need some special configuration in the project to be
    > reachable via S7Comm via ISO on TCP? nmap shows port 102 TCP as open.
    >
    > Any help is much appreciated!
    >
    > Mit freundlichen Grüßen
    > Kind regards
    >
    >
    > *Sebastian Wiendl *DSE / Digital Solutions Software Engineer
    > Phone: +49 9605 919 - 9341
    > <http://www.bhs-world.com<http://www.bhs-world.com/><http://www.bhs-world.com/>>E-Mail: SWiendl@bhs-world.com
    > Internet: www.bhs-world.com
    > Shop: www.icorr.shop
    > ------------------------------
    >
    >
    >
    > *BHS Corrugated Maschinen- und Anlagenbau GmbH *Paul-Engel-Straße 1
    > 92729 WEIHERHAMMER
    > GERMANY
    >
    > Management: Christian Engel, Lars Engel
    > Registered at Amtsgericht Weiden, HR B 1320
    > ------------------------------
    >
    >
    >
    >
    >
    
    --
    *CEOS Automatización, C.A.*
    *GALPON SERVICIO INDUSTRIALES Y NAVALES FA, C.A.,*
    *PISO 1, OFICINA 2, AV. RAUL LEONI, SECTOR GUAMACHITO,*
    
    *FRENTE A LA ASOCIACION DE GANADEROS,BARCELONA,EDO. ANZOATEGUI*
    *Ing. César García*
    *Cel: 0416-681.03.99*
    
    *Cel: 0414-760.98.95*
    
    *Hotline Técnica SIEMENS: 0800 1005080*
    
    *Email: support.aan.automation@siemens.com
    <su...@siemens.com>*
    
    
    
    
    
    
    


Re: Antwort: Re: Antwort: Re: Configuring a S7-1500 for Access with PLC4J

Posted by Julian Feinauer <j....@pragmaticminds.de>.
Hi Sebastian,

thanks fort he response, good to hear that it works now.
The stacktrace that you show could be related to the disconnect, indeed.
I remember that it was a bit tricky to get it right and if you would create a Jira I can try to look into it.

To your question regarding S7CommPlus (optimized datablocks):
We currently cannot but there is a long discussion around this topic (I would like it too).
The main issue is that we would need to reverse engineer some part of the TIA Libraries to extract private keys of a cryptographic challenge that is done during initial handshake which is illegal in Germany (“Hackerparagraph”).

But we are on the topic and have ideas for other ways around it as it would be really good to have this feature.

Julian

Von: Sebastian Wiendl <SW...@bhs-corrugated.de>
Antworten an: "dev@plc4x.apache.org" <de...@plc4x.apache.org>
Datum: Freitag, 8. November 2019 um 12:55
An: "dev@plc4x.apache.org" <de...@plc4x.apache.org>
Betreff: Antwort: Re: Antwort: Re: Configuring a S7-1500 for Access with PLC4J

Hi all,

news from my side: The logged exception happens during the disconnect phase. Connecting, pinging and reading values works just fine. Fun Fact: The communication works regardless of the specified rack/slot.

This is my updated program:


public static void main(String[] args) {
   try (PlcConnection plcConnection = new PlcDriverManager().getConnection("s7://172.30.74.65/0/0")) {
       System.out.println("connected");
       System.out.println(plcConnection);
       CompletableFuture<Void> ping = plcConnection.ping();
       ping.get(500, TimeUnit.MILLISECONDS);
       System.out.println("ping exception = " + ping.isCompletedExceptionally());

       // non optimized DB
       for (int i = 0; i < 3; i++) {
           PlcReadRequest.Builder builder = plcConnection.readRequestBuilder();
           final String fieldName = "field";
           builder.addItem(fieldName, "%DB101.DBW78:INT");
           PlcReadRequest readRequest = builder.build();
           LocalDateTime start = now();
           PlcReadResponse plcReadResponse = readRequest.execute().get();
           System.out.println("request took " + Duration.between(start, now()));
           System.out.println(fieldName + " response: " + plcReadResponse.getResponseCode(fieldName) + "; value: " + plcReadResponse.getInteger(fieldName));
       }

       try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
           br.readLine();
       }
   } catch (Exception e) {
       e.printStackTrace();
   }
   System.out.println("disconnected");
}

The execution yields this output:

SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
connected
org.apache.plc4x.java.s7.connection.S7PlcConnection@131276c2
ping exception = false
request took PT0.029S
field response: OK; value: 2
request took PT0.002S
field response: OK; value: 2
request took PT0.002S
field response: OK; value: 2

Nov 08, 2019 12:53:36 PM io.netty.channel.DefaultChannelPipeline onUnhandledInboundException
WARNUNG: 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: Eine vorhandene Verbindung wurde vom Remotehost geschlossen
        at sun.nio.ch.SocketDispatcher.read0(Native Method)
        at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:43)
        at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:223)
        at sun.nio.ch.IOUtil.read(IOUtil.java:192)
        at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:380)
        at io.netty.buffer.PooledUnsafeDirectByteBuf.setBytes(PooledUnsafeDirectByteBuf.java:288)
        at io.netty.buffer.AbstractByteBuf.writeBytes(AbstractByteBuf.java:1125)
        at io.netty.channel.socket.nio.NioSocketChannel.doReadBytes(NioSocketChannel.java:347)
        at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:148)
        at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:682)
        at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:617)
        at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:534)
        at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:496)
        at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:906)
        at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
        at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
        at java.lang.Thread.run(Thread.java:748)

disconnected

The exception only shows after pressing enter, therefore during the disconnect. I think what i discovered is a non-issue. Not nice, but not stopping me.

BTW does PLC4J support reading optimized S7 DBs? If not, is support for this planned at some point in time?

Mit freundlichen Grüßen
Kind regards

Sebastian Wiendl
DSE / Digital Solutions Software Engineer
Phone: +49 9605 919 - 9341
E-Mail: SWiendl@bhs-world.com
Internet: www.bhs-world.com<https://www.bhs-world.com>
Shop: www.icorr.shop
________________________________
 [cid:_1_15253CC8152538CC00417B1CC12584AC]

BHS Corrugated Maschinen- und Anlagenbau GmbH
Paul-Engel-Straße 1
92729 WEIHERHAMMER
GERMANY

Management: Christian Engel, Lars Engel
Registered at Amtsgericht Weiden, HR B 1320

________________________________

[cid:_2_158FEFC0158FEE7000417B1CC12584AC]
[cid:_2_158FF6A4158FF2C000417B1CC12584AC]
[cid:_2_158FFC90158FF8AC00417B1CC12584AC]


[cid:_1_1590012C158FF9FC00417B1CC12584AC]




Von:        "Tim Mitsch" <t....@pragmaticindustries.de>
An:        "dev@plc4x.apache.org" <de...@plc4x.apache.org>
Datum:        07.11.2019 17:47
Betreff:        Re: Antwort: Re: Configuring a S7-1500 for Access with PLC4J
________________________________



Hey Sebastian

Sorry for delayed answer – but first of all warm welcome on the list.

Just tested ur code-snippet vs our S7-1515 and is working fine.
U said u activated Put/Get.
Do u have the possibility to execute the scraper runner:
Plc4j/util/scraper/test/TriggeredScraperRunner

U need to adjust the ‘example_triggered_scraper.yml’ to ur needs (ip, field) …
Please take into account that the field to be read from must be a NON-optimized block

If there are still issue please write on the list and I can make a cross-check to the S7 Settings.

Best
Tim



Von: Sebastian Wiendl <SW...@bhs-corrugated.de>
Antworten an: "dev@plc4x.apache.org" <de...@plc4x.apache.org>
Datum: Donnerstag, 7. November 2019 um 16:29
An: "dev@plc4x.apache.org" <de...@plc4x.apache.org>
Betreff: Antwort: Re: Configuring a S7-1500 for Access with PLC4J

Hi Cesar,

thanks for your input.

s7://172.30.74.65/0/0 <http://172.30.74.65/0/2> is an illegal plc4j connection string. (The PLC's webserver is disabled btw.)

s7://172.30.74.65/0/0 yields the same exception as before.

I checked with our IT department in parallel - there is one router between me and the PLC and port 102 is open and reachable. No firewalls either.

Mit freundlichen Grüßen
Kind regards

Sebastian Wiendl
DSE / Digital Solutions Software Engineer
Phone: +49 9605 919 - 9341
E-Mail: SWiendl@bhs-world.com
Internet: www.bhs-world.com<https://www.bhs-world.com<https://www.bhs-world.com/>>
Shop: www.icorr.shop
________________________________
[cid:_1_150B9900150B9504005508A3C12584AB]

BHS Corrugated Maschinen- und Anlagenbau GmbH
Paul-Engel-Straße 1
92729 WEIHERHAMMER
GERMANY

Management: Christian Engel, Lars Engel
Registered at Amtsgericht Weiden, HR B 1320

________________________________

[cid:_2_150BB3DC150BAFF8005508A3C12584AB]
[cid:_2_150BB9C8150BB5E4005508A3C12584AB]
[cid:_2_150BBFB4150BBBD0005508A3C12584AB]


[cid:_1_150BC450150BBD20005508A3C12584AB]




Von:        "Cesar Garcia" <ce...@ceos.com.ve>
An:        "Apache PLC4X" <de...@plc4x.apache.org>
Datum:        07.11.2019 15:53
Betreff:        Re: Configuring a S7-1500 for Access with PLC4J
________________________________



Hello,

Try (*"s7://172.30.74.65/0/0 <http://172.30.74.65/0/2>")*

For S7-1200 and S7-1500 is Rack=0, Slot=0,

Best regards

El jue., 7 nov. 2019 a las 9:58, Sebastian Wiendl (<
SWiendl@bhs-corrugated.de>) escribió:

> Hello everyone,
>
> my sample program of PLC4J (very similiar to the hello world example)
> fails to connect to my test PLC (S7-1500):
>
> Nov 07, 2019 2:37:51 PM io.netty.channel.DefaultChannelPipeline
> onUnhandledInboundException
> WARNUNG: 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: Eine vorhandene Verbindung wurde vom Remotehost
> geschlossen
>         at sun.nio.ch.SocketDispatcher.read0(Native Method)
>         at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:43)
>         at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:223)
>         at sun.nio.ch.IOUtil.read(IOUtil.java:192)
>         at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:380)
>         at
> io.netty.buffer.PooledUnsafeDirectByteBuf.setBytes(PooledUnsafeDirectByteBuf.java:288)
>         at
> io.netty.buffer.AbstractByteBuf.writeBytes(AbstractByteBuf.java:1125)
>         at
> io.netty.channel.socket.nio.NioSocketChannel.doReadBytes(NioSocketChannel.java:347)
>         at
> io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:148)
>         at
> io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:682)
>         at
> io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:617)
>         at
> io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:534)
>         at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:496)
>         at
> io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:906)
>         at
> io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
>         at
> io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
>         at java.lang.Thread.run(Thread.java:748)
>
> "An existing connection was closed by the remote host"
>
> Thats my program at the moment:
>
>
>     *public static void *main(String[] args) {
>        *try *(PlcConnection plcConnection = *new *
> PlcDriverManager().getConnection(*"s7://172.30.74.65/0/2
> <http://172.30.74.65/0/2>"*)) {
>            System.*out*.println(*"connected"*);
>            System.*out*.println(plcConnection);
>            CompletableFuture<Void> ping = plcConnection.ping();
>            ping.get(500, TimeUnit.*MILLISECONDS*);
>            System.*out*.println(*"ping exception = " *+
> ping.isCompletedExceptionally());
>        } *catch *(Exception e) {
>            e.printStackTrace();
>        }
>        System.*out*.println(*"disconnected"*);
>    }
>
> I can both ping the PLC as well as connect to it with the Siemens TIA
> Portal. Does the PLC need some special configuration in the project to be
> reachable via S7Comm via ISO on TCP? nmap shows port 102 TCP as open.
>
> Any help is much appreciated!
>
> Mit freundlichen Grüßen
> Kind regards
>
>
> *Sebastian Wiendl *DSE / Digital Solutions Software Engineer
> Phone: +49 9605 919 - 9341
> <http://www.bhs-world.com<http://www.bhs-world.com/><http://www.bhs-world.com/>>E-Mail: SWiendl@bhs-world.com
> Internet: www.bhs-world.com
> Shop: www.icorr.shop
> ------------------------------
>
>
>
> *BHS Corrugated Maschinen- und Anlagenbau GmbH *Paul-Engel-Straße 1
> 92729 WEIHERHAMMER
> GERMANY
>
> Management: Christian Engel, Lars Engel
> Registered at Amtsgericht Weiden, HR B 1320
> ------------------------------
>
>
>
>
>

--
*CEOS Automatización, C.A.*
*GALPON SERVICIO INDUSTRIALES Y NAVALES FA, C.A.,*
*PISO 1, OFICINA 2, AV. RAUL LEONI, SECTOR GUAMACHITO,*

*FRENTE A LA ASOCIACION DE GANADEROS,BARCELONA,EDO. ANZOATEGUI*
*Ing. César García*
*Cel: 0416-681.03.99*

*Cel: 0414-760.98.95*

*Hotline Técnica SIEMENS: 0800 1005080*

*Email: support.aan.automation@siemens.com
<su...@siemens.com>*







Antwort: Re: Antwort: Re: Configuring a S7-1500 for Access with PLC4J

Posted by Sebastian Wiendl <SW...@bhs-corrugated.de>.
Hi all,

news from my side: The logged exception happens during the disconnect 
phase. Connecting, pinging and reading values works just fine. Fun Fact: 
The communication works regardless of the specified rack/slot.

This is my updated program:


public static void main(String[] args) {
    try (PlcConnection plcConnection = new 
PlcDriverManager().getConnection("s7://172.30.74.65/0/0")) {
        System.out.println("connected");
        System.out.println(plcConnection);
        CompletableFuture<Void> ping = plcConnection.ping();
        ping.get(500, TimeUnit.MILLISECONDS);
        System.out.println("ping exception = " + 
ping.isCompletedExceptionally());

        // non optimized DB
        for (int i = 0; i < 3; i++) {
            PlcReadRequest.Builder builder = 
plcConnection.readRequestBuilder();
            final String fieldName = "field";
            builder.addItem(fieldName, "%DB101.DBW78:INT");
            PlcReadRequest readRequest = builder.build();
            LocalDateTime start = now();
            PlcReadResponse plcReadResponse = readRequest.execute().get();
            System.out.println("request took " + Duration.between(start, 
now()));
            System.out.println(fieldName + " response: " + 
plcReadResponse.getResponseCode(fieldName) + "; value: " + 
plcReadResponse.getInteger(fieldName));
        }
 
        try (BufferedReader br = new BufferedReader(new 
InputStreamReader(System.in))) {
            br.readLine();
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
    System.out.println("disconnected");
}

The execution yields this output:

SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further 
details.
connected
org.apache.plc4x.java.s7.connection.S7PlcConnection@131276c2
ping exception = false
request took PT0.029S
field response: OK; value: 2
request took PT0.002S
field response: OK; value: 2
request took PT0.002S
field response: OK; value: 2

Nov 08, 2019 12:53:36 PM io.netty.channel.DefaultChannelPipeline 
onUnhandledInboundException
WARNUNG: 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: Eine vorhandene Verbindung wurde vom Remotehost 
geschlossen
        at sun.nio.ch.SocketDispatcher.read0(Native Method)
        at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:43)
        at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:223)
        at sun.nio.ch.IOUtil.read(IOUtil.java:192)
        at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:380)
        at 
io.netty.buffer.PooledUnsafeDirectByteBuf.setBytes(PooledUnsafeDirectByteBuf.java:288)
        at 
io.netty.buffer.AbstractByteBuf.writeBytes(AbstractByteBuf.java:1125)
        at 
io.netty.channel.socket.nio.NioSocketChannel.doReadBytes(NioSocketChannel.java:347)
        at 
io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:148)
        at 
io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:682)
        at 
io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:617)
        at 
io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:534)
        at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:496)
        at 
io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:906)
        at 
io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
        at 
io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
        at java.lang.Thread.run(Thread.java:748)

disconnected

The exception only shows after pressing enter, therefore during the 
disconnect. I think what i discovered is a non-issue. Not nice, but not 
stopping me.

BTW does PLC4J support reading optimized S7 DBs? If not, is support for 
this planned at some point in time?

Mit freundlichen Grüßen
Kind regards

Sebastian Wiendl
DSE / Digital Solutions Software Engineer
Phone: +49 9605 919 - 9341
E-Mail: SWiendl@bhs-world.com
Internet: www.bhs-world.com
Shop: www.icorr.shop

 

BHS Corrugated Maschinen- und Anlagenbau GmbH
Paul-Engel-Straße 1
92729 WEIHERHAMMER
GERMANY

Management: Christian Engel, Lars Engel
Registered at Amtsgericht Weiden, HR B 1320











Von:    "Tim Mitsch" <t....@pragmaticindustries.de>
An:     "dev@plc4x.apache.org" <de...@plc4x.apache.org>
Datum:  07.11.2019 17:47
Betreff:        Re: Antwort: Re: Configuring a S7-1500 for Access with 
PLC4J



Hey Sebastian

Sorry for delayed answer ? but first of all warm welcome on the list.

Just tested ur code-snippet vs our S7-1515 and is working fine.
U said u activated Put/Get.
Do u have the possibility to execute the scraper runner:
Plc4j/util/scraper/test/TriggeredScraperRunner

U need to adjust the ?example_triggered_scraper.yml? to ur needs (ip, 
field) ?
Please take into account that the field to be read from must be a 
NON-optimized block

If there are still issue please write on the list and I can make a 
cross-check to the S7 Settings.

Best
Tim



Von: Sebastian Wiendl <SW...@bhs-corrugated.de>
Antworten an: "dev@plc4x.apache.org" <de...@plc4x.apache.org>
Datum: Donnerstag, 7. November 2019 um 16:29
An: "dev@plc4x.apache.org" <de...@plc4x.apache.org>
Betreff: Antwort: Re: Configuring a S7-1500 for Access with PLC4J

Hi Cesar,

thanks for your input.

s7://172.30.74.65/0/0 <http://172.30.74.65/0/2> is an illegal plc4j 
connection string. (The PLC's webserver is disabled btw.)

s7://172.30.74.65/0/0 yields the same exception as before.

I checked with our IT department in parallel - there is one router between 
me and the PLC and port 102 is open and reachable. No firewalls either.

Mit freundlichen Grüßen
Kind regards

Sebastian Wiendl
DSE / Digital Solutions Software Engineer
Phone: +49 9605 919 - 9341
E-Mail: SWiendl@bhs-world.com
Internet: www.bhs-world.com<https://www.bhs-world.com>
Shop: www.icorr.shop
________________________________
 [cid:_1_150B9900150B9504005508A3C12584AB]

BHS Corrugated Maschinen- und Anlagenbau GmbH
Paul-Engel-Straße 1
92729 WEIHERHAMMER
GERMANY

Management: Christian Engel, Lars Engel
Registered at Amtsgericht Weiden, HR B 1320

________________________________

[cid:_2_150BB3DC150BAFF8005508A3C12584AB]
[cid:_2_150BB9C8150BB5E4005508A3C12584AB]
[cid:_2_150BBFB4150BBBD0005508A3C12584AB]


[cid:_1_150BC450150BBD20005508A3C12584AB]




Von:        "Cesar Garcia" <ce...@ceos.com.ve>
An:        "Apache PLC4X" <de...@plc4x.apache.org>
Datum:        07.11.2019 15:53
Betreff:        Re: Configuring a S7-1500 for Access with PLC4J
________________________________



Hello,

Try (*"s7://172.30.74.65/0/0 <http://172.30.74.65/0/2>")*

For S7-1200 and S7-1500 is Rack=0, Slot=0,

Best regards

El jue., 7 nov. 2019 a las 9:58, Sebastian Wiendl (<
SWiendl@bhs-corrugated.de>) escribió:

> Hello everyone,
>
> my sample program of PLC4J (very similiar to the hello world example)
> fails to connect to my test PLC (S7-1500):
>
> Nov 07, 2019 2:37:51 PM io.netty.channel.DefaultChannelPipeline
> onUnhandledInboundException
> WARNUNG: 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: Eine vorhandene Verbindung wurde vom Remotehost
> geschlossen
>         at sun.nio.ch.SocketDispatcher.read0(Native Method)
>         at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:43)
>         at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:223)
>         at sun.nio.ch.IOUtil.read(IOUtil.java:192)
>         at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:380)
>         at
> 
io.netty.buffer.PooledUnsafeDirectByteBuf.setBytes(PooledUnsafeDirectByteBuf.java:288)
>         at
> io.netty.buffer.AbstractByteBuf.writeBytes(AbstractByteBuf.java:1125)
>         at
> 
io.netty.channel.socket.nio.NioSocketChannel.doReadBytes(NioSocketChannel.java:347)
>         at
> 
io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:148)
>         at
> 
io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:682)
>         at
> 
io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:617)
>         at
> 
io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:534)
>         at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:496)
>         at
> 
io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:906)
>         at
> 
io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
>         at
> 
io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
>         at java.lang.Thread.run(Thread.java:748)
>
> "An existing connection was closed by the remote host"
>
> Thats my program at the moment:
>
>
>     *public static void *main(String[] args) {
>        *try *(PlcConnection plcConnection = *new *
> PlcDriverManager().getConnection(*"s7://172.30.74.65/0/2
> <http://172.30.74.65/0/2>"*)) {
>            System.*out*.println(*"connected"*);
>            System.*out*.println(plcConnection);
>            CompletableFuture<Void> ping = plcConnection.ping();
>            ping.get(500, TimeUnit.*MILLISECONDS*);
>            System.*out*.println(*"ping exception = " *+
> ping.isCompletedExceptionally());
>        } *catch *(Exception e) {
>            e.printStackTrace();
>        }
>        System.*out*.println(*"disconnected"*);
>    }
>
> I can both ping the PLC as well as connect to it with the Siemens TIA
> Portal. Does the PLC need some special configuration in the project to 
be
> reachable via S7Comm via ISO on TCP? nmap shows port 102 TCP as open.
>
> Any help is much appreciated!
>
> Mit freundlichen Grüßen
> Kind regards
>
>
> *Sebastian Wiendl *DSE / Digital Solutions Software Engineer
> Phone: +49 9605 919 - 9341
> <http://www.bhs-world.com<http://www.bhs-world.com/>>E-Mail: 
SWiendl@bhs-world.com
> Internet: www.bhs-world.com
> Shop: www.icorr.shop
> ------------------------------
>
>
>
> *BHS Corrugated Maschinen- und Anlagenbau GmbH *Paul-Engel-Straße 1
> 92729 WEIHERHAMMER
> GERMANY
>
> Management: Christian Engel, Lars Engel
> Registered at Amtsgericht Weiden, HR B 1320
> ------------------------------
>
>
>
>
>

--
*CEOS Automatización, C.A.*
*GALPON SERVICIO INDUSTRIALES Y NAVALES FA, C.A.,*
*PISO 1, OFICINA 2, AV. RAUL LEONI, SECTOR GUAMACHITO,*

*FRENTE A LA ASOCIACION DE GANADEROS,BARCELONA,EDO. ANZOATEGUI*
*Ing. César García*
*Cel: 0416-681.03.99*

*Cel: 0414-760.98.95*

*Hotline Técnica SIEMENS: 0800 1005080*

*Email: support.aan.automation@siemens.com
<su...@siemens.com>*






Re: Antwort: Re: Configuring a S7-1500 for Access with PLC4J

Posted by Tim Mitsch <t....@pragmaticindustries.de>.
Hey Sebastian

Sorry for delayed answer – but first of all warm welcome on the list.

Just tested ur code-snippet vs our S7-1515 and is working fine.
U said u activated Put/Get.
Do u have the possibility to execute the scraper runner:
Plc4j/util/scraper/test/TriggeredScraperRunner

U need to adjust the ‘example_triggered_scraper.yml’ to ur needs (ip, field) …
Please take into account that the field to be read from must be a NON-optimized block

If there are still issue please write on the list and I can make a cross-check to the S7 Settings.

Best
Tim



Von: Sebastian Wiendl <SW...@bhs-corrugated.de>
Antworten an: "dev@plc4x.apache.org" <de...@plc4x.apache.org>
Datum: Donnerstag, 7. November 2019 um 16:29
An: "dev@plc4x.apache.org" <de...@plc4x.apache.org>
Betreff: Antwort: Re: Configuring a S7-1500 for Access with PLC4J

Hi Cesar,

thanks for your input.

s7://172.30.74.65/0/0 <http://172.30.74.65/0/2> is an illegal plc4j connection string. (The PLC's webserver is disabled btw.)

s7://172.30.74.65/0/0 yields the same exception as before.

I checked with our IT department in parallel - there is one router between me and the PLC and port 102 is open and reachable. No firewalls either.

Mit freundlichen Grüßen
Kind regards

Sebastian Wiendl
DSE / Digital Solutions Software Engineer
Phone: +49 9605 919 - 9341
E-Mail: SWiendl@bhs-world.com
Internet: www.bhs-world.com<https://www.bhs-world.com>
Shop: www.icorr.shop
________________________________
 [cid:_1_150B9900150B9504005508A3C12584AB]

BHS Corrugated Maschinen- und Anlagenbau GmbH
Paul-Engel-Straße 1
92729 WEIHERHAMMER
GERMANY

Management: Christian Engel, Lars Engel
Registered at Amtsgericht Weiden, HR B 1320

________________________________

[cid:_2_150BB3DC150BAFF8005508A3C12584AB]
[cid:_2_150BB9C8150BB5E4005508A3C12584AB]
[cid:_2_150BBFB4150BBBD0005508A3C12584AB]


[cid:_1_150BC450150BBD20005508A3C12584AB]




Von:        "Cesar Garcia" <ce...@ceos.com.ve>
An:        "Apache PLC4X" <de...@plc4x.apache.org>
Datum:        07.11.2019 15:53
Betreff:        Re: Configuring a S7-1500 for Access with PLC4J
________________________________



Hello,

Try (*"s7://172.30.74.65/0/0 <http://172.30.74.65/0/2>")*

For S7-1200 and S7-1500 is Rack=0, Slot=0,

Best regards

El jue., 7 nov. 2019 a las 9:58, Sebastian Wiendl (<
SWiendl@bhs-corrugated.de>) escribió:

> Hello everyone,
>
> my sample program of PLC4J (very similiar to the hello world example)
> fails to connect to my test PLC (S7-1500):
>
> Nov 07, 2019 2:37:51 PM io.netty.channel.DefaultChannelPipeline
> onUnhandledInboundException
> WARNUNG: 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: Eine vorhandene Verbindung wurde vom Remotehost
> geschlossen
>         at sun.nio.ch.SocketDispatcher.read0(Native Method)
>         at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:43)
>         at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:223)
>         at sun.nio.ch.IOUtil.read(IOUtil.java:192)
>         at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:380)
>         at
> io.netty.buffer.PooledUnsafeDirectByteBuf.setBytes(PooledUnsafeDirectByteBuf.java:288)
>         at
> io.netty.buffer.AbstractByteBuf.writeBytes(AbstractByteBuf.java:1125)
>         at
> io.netty.channel.socket.nio.NioSocketChannel.doReadBytes(NioSocketChannel.java:347)
>         at
> io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:148)
>         at
> io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:682)
>         at
> io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:617)
>         at
> io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:534)
>         at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:496)
>         at
> io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:906)
>         at
> io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
>         at
> io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
>         at java.lang.Thread.run(Thread.java:748)
>
> "An existing connection was closed by the remote host"
>
> Thats my program at the moment:
>
>
>     *public static void *main(String[] args) {
>        *try *(PlcConnection plcConnection = *new *
> PlcDriverManager().getConnection(*"s7://172.30.74.65/0/2
> <http://172.30.74.65/0/2>"*)) {
>            System.*out*.println(*"connected"*);
>            System.*out*.println(plcConnection);
>            CompletableFuture<Void> ping = plcConnection.ping();
>            ping.get(500, TimeUnit.*MILLISECONDS*);
>            System.*out*.println(*"ping exception = " *+
> ping.isCompletedExceptionally());
>        } *catch *(Exception e) {
>            e.printStackTrace();
>        }
>        System.*out*.println(*"disconnected"*);
>    }
>
> I can both ping the PLC as well as connect to it with the Siemens TIA
> Portal. Does the PLC need some special configuration in the project to be
> reachable via S7Comm via ISO on TCP? nmap shows port 102 TCP as open.
>
> Any help is much appreciated!
>
> Mit freundlichen Grüßen
> Kind regards
>
>
> *Sebastian Wiendl *DSE / Digital Solutions Software Engineer
> Phone: +49 9605 919 - 9341
> <http://www.bhs-world.com<http://www.bhs-world.com/>>E-Mail: SWiendl@bhs-world.com
> Internet: www.bhs-world.com
> Shop: www.icorr.shop
> ------------------------------
>
>
>
> *BHS Corrugated Maschinen- und Anlagenbau GmbH *Paul-Engel-Straße 1
> 92729 WEIHERHAMMER
> GERMANY
>
> Management: Christian Engel, Lars Engel
> Registered at Amtsgericht Weiden, HR B 1320
> ------------------------------
>
>
>
>
>

--
*CEOS Automatización, C.A.*
*GALPON SERVICIO INDUSTRIALES Y NAVALES FA, C.A.,*
*PISO 1, OFICINA 2, AV. RAUL LEONI, SECTOR GUAMACHITO,*

*FRENTE A LA ASOCIACION DE GANADEROS,BARCELONA,EDO. ANZOATEGUI*
*Ing. César García*
*Cel: 0416-681.03.99*

*Cel: 0414-760.98.95*

*Hotline Técnica SIEMENS: 0800 1005080*

*Email: support.aan.automation@siemens.com
<su...@siemens.com>*




Antwort: Re: Configuring a S7-1500 for Access with PLC4J

Posted by Sebastian Wiendl <SW...@bhs-corrugated.de>.
Hi Cesar,

thanks for your input.

s7://172.30.74.65/0/0 <http://172.30.74.65/0/2> is an illegal plc4j 
connection string. (The PLC's webserver is disabled btw.)

s7://172.30.74.65/0/0 yields the same exception as before.

I checked with our IT department in parallel - there is one router between 
me and the PLC and port 102 is open and reachable. No firewalls either.

Mit freundlichen Grüßen
Kind regards

Sebastian Wiendl
DSE / Digital Solutions Software Engineer
Phone: +49 9605 919 - 9341
E-Mail: SWiendl@bhs-world.com
Internet: www.bhs-world.com
Shop: www.icorr.shop

 

BHS Corrugated Maschinen- und Anlagenbau GmbH
Paul-Engel-Straße 1
92729 WEIHERHAMMER
GERMANY

Management: Christian Engel, Lars Engel
Registered at Amtsgericht Weiden, HR B 1320











Von:    "Cesar Garcia" <ce...@ceos.com.ve>
An:     "Apache PLC4X" <de...@plc4x.apache.org>
Datum:  07.11.2019 15:53
Betreff:        Re: Configuring a S7-1500 for Access with PLC4J



Hello,

Try (*"s7://172.30.74.65/0/0 <http://172.30.74.65/0/2>")*

For S7-1200 and S7-1500 is Rack=0, Slot=0,

Best regards

El jue., 7 nov. 2019 a las 9:58, Sebastian Wiendl (<
SWiendl@bhs-corrugated.de>) escribió:

> Hello everyone,
>
> my sample program of PLC4J (very similiar to the hello world example)
> fails to connect to my test PLC (S7-1500):
>
> Nov 07, 2019 2:37:51 PM io.netty.channel.DefaultChannelPipeline
> onUnhandledInboundException
> WARNUNG: 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: Eine vorhandene Verbindung wurde vom Remotehost
> geschlossen
>         at sun.nio.ch.SocketDispatcher.read0(Native Method)
>         at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:43)
>         at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:223)
>         at sun.nio.ch.IOUtil.read(IOUtil.java:192)
>         at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:380)
>         at
> 
io.netty.buffer.PooledUnsafeDirectByteBuf.setBytes(PooledUnsafeDirectByteBuf.java:288)
>         at
> io.netty.buffer.AbstractByteBuf.writeBytes(AbstractByteBuf.java:1125)
>         at
> 
io.netty.channel.socket.nio.NioSocketChannel.doReadBytes(NioSocketChannel.java:347)
>         at
> 
io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:148)
>         at
> 
io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:682)
>         at
> 
io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:617)
>         at
> 
io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:534)
>         at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:496)
>         at
> 
io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:906)
>         at
> 
io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
>         at
> 
io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
>         at java.lang.Thread.run(Thread.java:748)
>
> "An existing connection was closed by the remote host"
>
> Thats my program at the moment:
>
>
>     *public static void *main(String[] args) {
>        *try *(PlcConnection plcConnection = *new *
> PlcDriverManager().getConnection(*"s7://172.30.74.65/0/2
> <http://172.30.74.65/0/2>"*)) {
>            System.*out*.println(*"connected"*);
>            System.*out*.println(plcConnection);
>            CompletableFuture<Void> ping = plcConnection.ping();
>            ping.get(500, TimeUnit.*MILLISECONDS*);
>            System.*out*.println(*"ping exception = " *+
> ping.isCompletedExceptionally());
>        } *catch *(Exception e) {
>            e.printStackTrace();
>        }
>        System.*out*.println(*"disconnected"*);
>    }
>
> I can both ping the PLC as well as connect to it with the Siemens TIA
> Portal. Does the PLC need some special configuration in the project to 
be
> reachable via S7Comm via ISO on TCP? nmap shows port 102 TCP as open.
>
> Any help is much appreciated!
>
> Mit freundlichen Grüßen
> Kind regards
>
>
> *Sebastian Wiendl *DSE / Digital Solutions Software Engineer
> Phone: +49 9605 919 - 9341
> <http://www.bhs-world.com>E-Mail: SWiendl@bhs-world.com
> Internet: www.bhs-world.com
> Shop: www.icorr.shop
> ------------------------------
>
>
>
> *BHS Corrugated Maschinen- und Anlagenbau GmbH *Paul-Engel-Straße 1
> 92729 WEIHERHAMMER
> GERMANY
>
> Management: Christian Engel, Lars Engel
> Registered at Amtsgericht Weiden, HR B 1320
> ------------------------------
>
>
>
>
>

-- 
*CEOS Automatización, C.A.*
*GALPON SERVICIO INDUSTRIALES Y NAVALES FA, C.A.,*
*PISO 1, OFICINA 2, AV. RAUL LEONI, SECTOR GUAMACHITO,*

*FRENTE A LA ASOCIACION DE GANADEROS,BARCELONA,EDO. ANZOATEGUI*
*Ing. César García*
*Cel: 0416-681.03.99*

*Cel: 0414-760.98.95*

*Hotline Técnica SIEMENS: 0800 1005080*

*Email: support.aan.automation@siemens.com
<su...@siemens.com>*



Re: Configuring a S7-1500 for Access with PLC4J

Posted by Cesar Garcia <ce...@ceos.com.ve>.
Hi,

Some recipes from SIEMENS WinCC Flexible (Reck 0, Slot=1),

https://support.industry.siemens.com/cs/document/38111886/how-do-you-access-s7-1200-tags-with-a-panel-or-rt-configured-with-wincc-flexible-2008-sp2-?dti=0&lc=en-WW

WinCCFlexible

The recipe for SNAP7 work (Rack 0, Slot=0), ,

http://snap7.sourceforge.net/sharp7.html

The instructions in the SNAP7 manual worked for me


Best regards,








El jue., 7 nov. 2019 a las 11:27, Julian Feinauer (<
j.feinauer@pragmaticminds.de>) escribió:

> Hi Cesar,
>
> thanks fort he excellent hint... do you know any documentation about that?
> Would be good to state that somewhere in our documentation!
>
> Julian
>
> Am 07.11.19, 15:54 schrieb "Cesar Garcia" <ce...@ceos.com.ve>:
>
>     Hello,
>
>     Try (*"s7://172.30.74.65/0/0 <http://172.30.74.65/0/2>")*
>
>     For S7-1200 and S7-1500 is Rack=0, Slot=0,
>
>     Best regards
>
>     El jue., 7 nov. 2019 a las 9:58, Sebastian Wiendl (<
>     SWiendl@bhs-corrugated.de>) escribió:
>
>     > Hello everyone,
>     >
>     > my sample program of PLC4J (very similiar to the hello world example)
>     > fails to connect to my test PLC (S7-1500):
>     >
>     > Nov 07, 2019 2:37:51 PM io.netty.channel.DefaultChannelPipeline
>     > onUnhandledInboundException
>     > WARNUNG: 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: Eine vorhandene Verbindung wurde vom Remotehost
>     > geschlossen
>     >         at sun.nio.ch.SocketDispatcher.read0(Native Method)
>     >         at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:43)
>     >         at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:223)
>     >         at sun.nio.ch.IOUtil.read(IOUtil.java:192)
>     >         at
> sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:380)
>     >         at
>     >
> io.netty.buffer.PooledUnsafeDirectByteBuf.setBytes(PooledUnsafeDirectByteBuf.java:288)
>     >         at
>     > io.netty.buffer.AbstractByteBuf.writeBytes(AbstractByteBuf.java:1125)
>     >         at
>     >
> io.netty.channel.socket.nio.NioSocketChannel.doReadBytes(NioSocketChannel.java:347)
>     >         at
>     >
> io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:148)
>     >         at
>     >
> io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:682)
>     >         at
>     >
> io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:617)
>     >         at
>     >
> io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:534)
>     >         at
> io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:496)
>     >         at
>     >
> io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:906)
>     >         at
>     >
> io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
>     >         at
>     >
> io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
>     >         at java.lang.Thread.run(Thread.java:748)
>     >
>     > "An existing connection was closed by the remote host"
>     >
>     > Thats my program at the moment:
>     >
>     >
>     >     *public static void *main(String[] args) {
>     >        *try *(PlcConnection plcConnection = *new *
>     > PlcDriverManager().getConnection(*"s7://172.30.74.65/0/2
>     > <http://172.30.74.65/0/2>"*)) {
>     >            System.*out*.println(*"connected"*);
>     >            System.*out*.println(plcConnection);
>     >            CompletableFuture<Void> ping = plcConnection.ping();
>     >            ping.get(500, TimeUnit.*MILLISECONDS*);
>     >            System.*out*.println(*"ping exception = " *+
>     > ping.isCompletedExceptionally());
>     >        } *catch *(Exception e) {
>     >            e.printStackTrace();
>     >        }
>     >        System.*out*.println(*"disconnected"*);
>     >    }
>     >
>     > I can both ping the PLC as well as connect to it with the Siemens TIA
>     > Portal. Does the PLC need some special configuration in the project
> to be
>     > reachable via S7Comm via ISO on TCP? nmap shows port 102 TCP as open.
>     >
>     > Any help is much appreciated!
>     >
>     > Mit freundlichen Grüßen
>     > Kind regards
>     >
>     >
>     > *Sebastian Wiendl *DSE / Digital Solutions Software Engineer
>     > Phone: +49 9605 919 - 9341
>     > <http://www.bhs-world.com>E-Mail: SWiendl@bhs-world.com
>     > Internet: www.bhs-world.com
>     > Shop: www.icorr.shop
>     > ------------------------------
>     >
>     >
>     >
>     > *BHS Corrugated Maschinen- und Anlagenbau GmbH *Paul-Engel-Straße 1
>     > 92729 WEIHERHAMMER
>     > GERMANY
>     >
>     > Management: Christian Engel, Lars Engel
>     > Registered at Amtsgericht Weiden, HR B 1320
>     > ------------------------------
>     >
>     >
>     >
>     >
>     >
>
>     --
>     *CEOS Automatización, C.A.*
>     *GALPON SERVICIO INDUSTRIALES Y NAVALES FA, C.A.,*
>     *PISO 1, OFICINA 2, AV. RAUL LEONI, SECTOR GUAMACHITO,*
>
>     *FRENTE A LA ASOCIACION DE GANADEROS,BARCELONA,EDO. ANZOATEGUI*
>     *Ing. César García*
>     *Cel: 0416-681.03.99*
>
>     *Cel: 0414-760.98.95*
>
>     *Hotline Técnica SIEMENS: 0800 1005080*
>
>     *Email: support.aan.automation@siemens.com
>     <su...@siemens.com>*
>
>
>

-- 
*CEOS Automatización, C.A.*
*GALPON SERVICIO INDUSTRIALES Y NAVALES FA, C.A.,*
*PISO 1, OFICINA 2, AV. RAUL LEONI, SECTOR GUAMACHITO,*

*FRENTE A LA ASOCIACION DE GANADEROS,BARCELONA,EDO. ANZOATEGUI*
*Ing. César García*
*Cel: 0416-681.03.99*

*Cel: 0414-760.98.95*

*Hotline Técnica SIEMENS: 0800 1005080*

*Email: support.aan.automation@siemens.com
<su...@siemens.com>*

Re: Configuring a S7-1500 for Access with PLC4J

Posted by Julian Feinauer <j....@pragmaticminds.de>.
Hi Cesar,

thanks fort he excellent hint... do you know any documentation about that?
Would be good to state that somewhere in our documentation!

Julian

Am 07.11.19, 15:54 schrieb "Cesar Garcia" <ce...@ceos.com.ve>:

    Hello,
    
    Try (*"s7://172.30.74.65/0/0 <http://172.30.74.65/0/2>")*
    
    For S7-1200 and S7-1500 is Rack=0, Slot=0,
    
    Best regards
    
    El jue., 7 nov. 2019 a las 9:58, Sebastian Wiendl (<
    SWiendl@bhs-corrugated.de>) escribió:
    
    > Hello everyone,
    >
    > my sample program of PLC4J (very similiar to the hello world example)
    > fails to connect to my test PLC (S7-1500):
    >
    > Nov 07, 2019 2:37:51 PM io.netty.channel.DefaultChannelPipeline
    > onUnhandledInboundException
    > WARNUNG: 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: Eine vorhandene Verbindung wurde vom Remotehost
    > geschlossen
    >         at sun.nio.ch.SocketDispatcher.read0(Native Method)
    >         at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:43)
    >         at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:223)
    >         at sun.nio.ch.IOUtil.read(IOUtil.java:192)
    >         at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:380)
    >         at
    > io.netty.buffer.PooledUnsafeDirectByteBuf.setBytes(PooledUnsafeDirectByteBuf.java:288)
    >         at
    > io.netty.buffer.AbstractByteBuf.writeBytes(AbstractByteBuf.java:1125)
    >         at
    > io.netty.channel.socket.nio.NioSocketChannel.doReadBytes(NioSocketChannel.java:347)
    >         at
    > io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:148)
    >         at
    > io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:682)
    >         at
    > io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:617)
    >         at
    > io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:534)
    >         at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:496)
    >         at
    > io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:906)
    >         at
    > io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
    >         at
    > io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
    >         at java.lang.Thread.run(Thread.java:748)
    >
    > "An existing connection was closed by the remote host"
    >
    > Thats my program at the moment:
    >
    >
    >     *public static void *main(String[] args) {
    >        *try *(PlcConnection plcConnection = *new *
    > PlcDriverManager().getConnection(*"s7://172.30.74.65/0/2
    > <http://172.30.74.65/0/2>"*)) {
    >            System.*out*.println(*"connected"*);
    >            System.*out*.println(plcConnection);
    >            CompletableFuture<Void> ping = plcConnection.ping();
    >            ping.get(500, TimeUnit.*MILLISECONDS*);
    >            System.*out*.println(*"ping exception = " *+
    > ping.isCompletedExceptionally());
    >        } *catch *(Exception e) {
    >            e.printStackTrace();
    >        }
    >        System.*out*.println(*"disconnected"*);
    >    }
    >
    > I can both ping the PLC as well as connect to it with the Siemens TIA
    > Portal. Does the PLC need some special configuration in the project to be
    > reachable via S7Comm via ISO on TCP? nmap shows port 102 TCP as open.
    >
    > Any help is much appreciated!
    >
    > Mit freundlichen Grüßen
    > Kind regards
    >
    >
    > *Sebastian Wiendl *DSE / Digital Solutions Software Engineer
    > Phone: +49 9605 919 - 9341
    > <http://www.bhs-world.com>E-Mail: SWiendl@bhs-world.com
    > Internet: www.bhs-world.com
    > Shop: www.icorr.shop
    > ------------------------------
    >
    >
    >
    > *BHS Corrugated Maschinen- und Anlagenbau GmbH *Paul-Engel-Straße 1
    > 92729 WEIHERHAMMER
    > GERMANY
    >
    > Management: Christian Engel, Lars Engel
    > Registered at Amtsgericht Weiden, HR B 1320
    > ------------------------------
    >
    >
    >
    >
    >
    
    -- 
    *CEOS Automatización, C.A.*
    *GALPON SERVICIO INDUSTRIALES Y NAVALES FA, C.A.,*
    *PISO 1, OFICINA 2, AV. RAUL LEONI, SECTOR GUAMACHITO,*
    
    *FRENTE A LA ASOCIACION DE GANADEROS,BARCELONA,EDO. ANZOATEGUI*
    *Ing. César García*
    *Cel: 0416-681.03.99*
    
    *Cel: 0414-760.98.95*
    
    *Hotline Técnica SIEMENS: 0800 1005080*
    
    *Email: support.aan.automation@siemens.com
    <su...@siemens.com>*
    


Re: Configuring a S7-1500 for Access with PLC4J

Posted by Cesar Garcia <ce...@ceos.com.ve>.
Hello,

Try (*"s7://172.30.74.65/0/0 <http://172.30.74.65/0/2>")*

For S7-1200 and S7-1500 is Rack=0, Slot=0,

Best regards

El jue., 7 nov. 2019 a las 9:58, Sebastian Wiendl (<
SWiendl@bhs-corrugated.de>) escribió:

> Hello everyone,
>
> my sample program of PLC4J (very similiar to the hello world example)
> fails to connect to my test PLC (S7-1500):
>
> Nov 07, 2019 2:37:51 PM io.netty.channel.DefaultChannelPipeline
> onUnhandledInboundException
> WARNUNG: 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: Eine vorhandene Verbindung wurde vom Remotehost
> geschlossen
>         at sun.nio.ch.SocketDispatcher.read0(Native Method)
>         at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:43)
>         at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:223)
>         at sun.nio.ch.IOUtil.read(IOUtil.java:192)
>         at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:380)
>         at
> io.netty.buffer.PooledUnsafeDirectByteBuf.setBytes(PooledUnsafeDirectByteBuf.java:288)
>         at
> io.netty.buffer.AbstractByteBuf.writeBytes(AbstractByteBuf.java:1125)
>         at
> io.netty.channel.socket.nio.NioSocketChannel.doReadBytes(NioSocketChannel.java:347)
>         at
> io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:148)
>         at
> io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:682)
>         at
> io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:617)
>         at
> io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:534)
>         at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:496)
>         at
> io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:906)
>         at
> io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
>         at
> io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
>         at java.lang.Thread.run(Thread.java:748)
>
> "An existing connection was closed by the remote host"
>
> Thats my program at the moment:
>
>
>     *public static void *main(String[] args) {
>        *try *(PlcConnection plcConnection = *new *
> PlcDriverManager().getConnection(*"s7://172.30.74.65/0/2
> <http://172.30.74.65/0/2>"*)) {
>            System.*out*.println(*"connected"*);
>            System.*out*.println(plcConnection);
>            CompletableFuture<Void> ping = plcConnection.ping();
>            ping.get(500, TimeUnit.*MILLISECONDS*);
>            System.*out*.println(*"ping exception = " *+
> ping.isCompletedExceptionally());
>        } *catch *(Exception e) {
>            e.printStackTrace();
>        }
>        System.*out*.println(*"disconnected"*);
>    }
>
> I can both ping the PLC as well as connect to it with the Siemens TIA
> Portal. Does the PLC need some special configuration in the project to be
> reachable via S7Comm via ISO on TCP? nmap shows port 102 TCP as open.
>
> Any help is much appreciated!
>
> Mit freundlichen Grüßen
> Kind regards
>
>
> *Sebastian Wiendl *DSE / Digital Solutions Software Engineer
> Phone: +49 9605 919 - 9341
> <http://www.bhs-world.com>E-Mail: SWiendl@bhs-world.com
> Internet: www.bhs-world.com
> Shop: www.icorr.shop
> ------------------------------
>
>
>
> *BHS Corrugated Maschinen- und Anlagenbau GmbH *Paul-Engel-Straße 1
> 92729 WEIHERHAMMER
> GERMANY
>
> Management: Christian Engel, Lars Engel
> Registered at Amtsgericht Weiden, HR B 1320
> ------------------------------
>
>
>
>
>

-- 
*CEOS Automatización, C.A.*
*GALPON SERVICIO INDUSTRIALES Y NAVALES FA, C.A.,*
*PISO 1, OFICINA 2, AV. RAUL LEONI, SECTOR GUAMACHITO,*

*FRENTE A LA ASOCIACION DE GANADEROS,BARCELONA,EDO. ANZOATEGUI*
*Ing. César García*
*Cel: 0416-681.03.99*

*Cel: 0414-760.98.95*

*Hotline Técnica SIEMENS: 0800 1005080*

*Email: support.aan.automation@siemens.com
<su...@siemens.com>*

Re: Antwort: Re: Antwort: Re: Configuring a S7-1500 for Access with PLC4J

Posted by Julian Feinauer <j....@pragmaticminds.de>.
Hmmm... Interesting. Probably @Tim Mitsch<ma...@pragmaticindustries.de> has an idea?

Julian

Von: Sebastian Wiendl <SW...@bhs-corrugated.de>
Antworten an: "dev@plc4x.apache.org" <de...@plc4x.apache.org>
Datum: Donnerstag, 7. November 2019 um 15:10
An: "dev@plc4x.apache.org" <de...@plc4x.apache.org>
Betreff: Antwort: Re: Antwort: Re: Configuring a S7-1500 for Access with PLC4J

I tried both: GET/PUT enabled and GET/PUT disabled. I saw no difference in behaviour.

Mit freundlichen Grüßen
Kind regards

Sebastian Wiendl
DSE / Digital Solutions Software Engineer
Phone: +49 9605 919 - 9341
E-Mail: SWiendl@bhs-world.com
Internet: www.bhs-world.com<https://www.bhs-world.com>
Shop: www.icorr.shop
________________________________
 [cid:_1_1317DFE41317DBE8004DE14EC12584AB]

BHS Corrugated Maschinen- und Anlagenbau GmbH
Paul-Engel-Straße 1
92729 WEIHERHAMMER
GERMANY

Management: Christian Engel, Lars Engel
Registered at Amtsgericht Weiden, HR B 1320

________________________________

[cid:_2_1310EA941317F6DC004DE14EC12584AB]
[cid:_2_1310EC9C1317FAC0004DE14EC12584AB]
[cid:_2_1310F3801310EF9C004DE14EC12584AB]


[cid:_1_1310F81C1310F0EC004DE14EC12584AB]




Von:        "Julian Feinauer" <j....@pragmaticminds.de>
An:        "dev@plc4x.apache.org" <de...@plc4x.apache.org>
Datum:        07.11.2019 15:05
Betreff:        Re: Antwort: Re: Configuring a S7-1500 for Access with PLC4J
________________________________



Hey,

same to you : )
Hm, thats tricky.. I think we have never seen something like that before.
The only thing I could think of is GET/PUT not being enabled (via TIA) on the PLC but I’m unsure if that’s already for the connection or only for reads.

Julian

Von: Sebastian Wiendl <SW...@bhs-corrugated.de>
Antworten an: "dev@plc4x.apache.org" <de...@plc4x.apache.org>
Datum: Donnerstag, 7. November 2019 um 15:05
An: "dev@plc4x.apache.org" <de...@plc4x.apache.org>
Betreff: Antwort: Re: Configuring a S7-1500 for Access with PLC4J

Record Response Time :-)

I had a simple read before I tried the ping - same result. I think the exception already happens during the PlcDriverManager.getConnection.

Mit freundlichen Grüßen
Kind regards

Sebastian Wiendl
DSE / Digital Solutions Software Engineer
Phone: +49 9605 919 - 9341
E-Mail: SWiendl@bhs-world.com
Internet: www.bhs-world.com<https://www.bhs-world.com<https://www.bhs-world.com/>>
Shop: www.icorr.shop
________________________________
[cid:_1_14BA133414BA0F38004D60B2C12584AB]

BHS Corrugated Maschinen- und Anlagenbau GmbH
Paul-Engel-Straße 1
92729 WEIHERHAMMER
GERMANY

Management: Christian Engel, Lars Engel
Registered at Amtsgericht Weiden, HR B 1320

________________________________

[cid:_2_14BA2E1014BA2A2C004D60B2C12584AB]
[cid:_2_14BA33FC14BA3018004D60B2C12584AB]
[cid:_2_14BA39E814BA3604004D60B2C12584AB]


[cid:_1_14BA3E8414BA3754004D60B2C12584AB]




Von:        "Julian Feinauer" <j....@pragmaticminds.de>
An:        "dev@plc4x.apache.org" <de...@plc4x.apache.org>
Datum:        07.11.2019 15:01
Betreff:        Re: Configuring a S7-1500 for Access with PLC4J
________________________________



Hi Sebastian,

first of, welcome to PLC4X : )
Second, interesting Issue you have there.. I will try to reproduce it.
I think the issue is in the “ping()” method which does nothing “native” but rather uses the “ping” method of Netty’s channel handler.
It would be a better test to just do a “read()” on some Field like a Marker or something.

Could you try that?

Julian

Von: Sebastian Wiendl <SW...@bhs-corrugated.de>
Antworten an: "dev@plc4x.apache.org" <de...@plc4x.apache.org>
Datum: Donnerstag, 7. November 2019 um 14:58
An: "dev@plc4x.apache.org" <de...@plc4x.apache.org>
Betreff: Configuring a S7-1500 for Access with PLC4J

Hello everyone,

my sample program of PLC4J (very similiar to the hello world example) fails to connect to my test PLC (S7-1500):

Nov 07, 2019 2:37:51 PM io.netty.channel.DefaultChannelPipeline onUnhandledInboundException
WARNUNG: 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: Eine vorhandene Verbindung wurde vom Remotehost geschlossen
      at sun.nio.ch.SocketDispatcher.read0(Native Method)
      at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:43)
      at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:223)
      at sun.nio.ch.IOUtil.read(IOUtil.java:192)
      at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:380)
      at io.netty.buffer.PooledUnsafeDirectByteBuf.setBytes(PooledUnsafeDirectByteBuf.java:288)
      at io.netty.buffer.AbstractByteBuf.writeBytes(AbstractByteBuf.java:1125)
      at io.netty.channel.socket.nio.NioSocketChannel.doReadBytes(NioSocketChannel.java:347)
      at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:148)
      at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:682)
      at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:617)
      at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:534)
      at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:496)
      at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:906)
      at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
      at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
      at java.lang.Thread.run(Thread.java:748)

"An existing connection was closed by the remote host"

Thats my program at the moment:


  public static void main(String[] args) {
     try (PlcConnection plcConnection = new PlcDriverManager().getConnection("s7://172.30.74.65/0/2")) {
         System.out.println("connected");
         System.out.println(plcConnection);
         CompletableFuture<Void> ping = plcConnection.ping();
         ping.get(500, TimeUnit.MILLISECONDS);
         System.out.println("ping exception = " + ping.isCompletedExceptionally());
     } catch (Exception e) {
         e.printStackTrace();
     }
     System.out.println("disconnected");
 }

I can both ping the PLC as well as connect to it with the Siemens TIA Portal. Does the PLC need some special configuration in the project to be reachable via S7Comm via ISO on TCP? nmap shows port 102 TCP as open.

Any help is much appreciated!

Mit freundlichen Grüßen
Kind regards

Sebastian Wiendl
DSE / Digital Solutions Software Engineer
Phone: +49 9605 919 - 9341
E-Mail: SWiendl@bhs-world.com
Internet: www.bhs-world.com<https://www.bhs-world.com<https://www.bhs-world.com/><https://www.bhs-world.com/>>
Shop: www.icorr.shop
________________________________
[cid:_1_14F1425C14F13E60004CB934C12584AB]

BHS Corrugated Maschinen- und Anlagenbau GmbH
Paul-Engel-Straße 1
92729 WEIHERHAMMER
GERMANY

Management: Christian Engel, Lars Engel
Registered at Amtsgericht Weiden, HR B 1320

________________________________

[cid:_2_14F15D3814F15954004CB934C12584AB]
[cid:_2_14F1632414F15F40004CB934C12584AB]
[cid:_2_14F1691014F1652C004CB934C12584AB]


[cid:_1_14F16DAC14F1667C004CB934C12584AB]








Antwort: Re: Antwort: Re: Configuring a S7-1500 for Access with PLC4J

Posted by Sebastian Wiendl <SW...@bhs-corrugated.de>.
I tried both: GET/PUT enabled and GET/PUT disabled. I saw no difference in 
behaviour.

Mit freundlichen Grüßen
Kind regards

Sebastian Wiendl
DSE / Digital Solutions Software Engineer
Phone: +49 9605 919 - 9341
E-Mail: SWiendl@bhs-world.com
Internet: www.bhs-world.com
Shop: www.icorr.shop

 

BHS Corrugated Maschinen- und Anlagenbau GmbH
Paul-Engel-Straße 1
92729 WEIHERHAMMER
GERMANY

Management: Christian Engel, Lars Engel
Registered at Amtsgericht Weiden, HR B 1320











Von:    "Julian Feinauer" <j....@pragmaticminds.de>
An:     "dev@plc4x.apache.org" <de...@plc4x.apache.org>
Datum:  07.11.2019 15:05
Betreff:        Re: Antwort: Re: Configuring a S7-1500 for Access with 
PLC4J



Hey,

same to you : )
Hm, thats tricky.. I think we have never seen something like that before.
The only thing I could think of is GET/PUT not being enabled (via TIA) on 
the PLC but I?m unsure if that?s already for the connection or only for 
reads.

Julian

Von: Sebastian Wiendl <SW...@bhs-corrugated.de>
Antworten an: "dev@plc4x.apache.org" <de...@plc4x.apache.org>
Datum: Donnerstag, 7. November 2019 um 15:05
An: "dev@plc4x.apache.org" <de...@plc4x.apache.org>
Betreff: Antwort: Re: Configuring a S7-1500 for Access with PLC4J

Record Response Time :-)

I had a simple read before I tried the ping - same result. I think the 
exception already happens during the PlcDriverManager.getConnection.

Mit freundlichen Grüßen
Kind regards

Sebastian Wiendl
DSE / Digital Solutions Software Engineer
Phone: +49 9605 919 - 9341
E-Mail: SWiendl@bhs-world.com
Internet: www.bhs-world.com<https://www.bhs-world.com>
Shop: www.icorr.shop
________________________________
 [cid:_1_14BA133414BA0F38004D60B2C12584AB]

BHS Corrugated Maschinen- und Anlagenbau GmbH
Paul-Engel-Straße 1
92729 WEIHERHAMMER
GERMANY

Management: Christian Engel, Lars Engel
Registered at Amtsgericht Weiden, HR B 1320

________________________________

[cid:_2_14BA2E1014BA2A2C004D60B2C12584AB]
[cid:_2_14BA33FC14BA3018004D60B2C12584AB]
[cid:_2_14BA39E814BA3604004D60B2C12584AB]


[cid:_1_14BA3E8414BA3754004D60B2C12584AB]




Von:        "Julian Feinauer" <j....@pragmaticminds.de>
An:        "dev@plc4x.apache.org" <de...@plc4x.apache.org>
Datum:        07.11.2019 15:01
Betreff:        Re: Configuring a S7-1500 for Access with PLC4J
________________________________



Hi Sebastian,

first of, welcome to PLC4X : )
Second, interesting Issue you have there.. I will try to reproduce it.
I think the issue is in the ?ping()? method which does nothing ?native? 
but rather uses the ?ping? method of Netty?s channel handler.
It would be a better test to just do a ?read()? on some Field like a 
Marker or something.

Could you try that?

Julian

Von: Sebastian Wiendl <SW...@bhs-corrugated.de>
Antworten an: "dev@plc4x.apache.org" <de...@plc4x.apache.org>
Datum: Donnerstag, 7. November 2019 um 14:58
An: "dev@plc4x.apache.org" <de...@plc4x.apache.org>
Betreff: Configuring a S7-1500 for Access with PLC4J

Hello everyone,

my sample program of PLC4J (very similiar to the hello world example) 
fails to connect to my test PLC (S7-1500):

Nov 07, 2019 2:37:51 PM io.netty.channel.DefaultChannelPipeline 
onUnhandledInboundException
WARNUNG: 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: Eine vorhandene Verbindung wurde vom Remotehost 
geschlossen
       at sun.nio.ch.SocketDispatcher.read0(Native Method)
       at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:43)
       at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:223)
       at sun.nio.ch.IOUtil.read(IOUtil.java:192)
       at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:380)
       at 
io.netty.buffer.PooledUnsafeDirectByteBuf.setBytes(PooledUnsafeDirectByteBuf.java:288)
       at 
io.netty.buffer.AbstractByteBuf.writeBytes(AbstractByteBuf.java:1125)
       at 
io.netty.channel.socket.nio.NioSocketChannel.doReadBytes(NioSocketChannel.java:347)
       at 
io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:148)
       at 
io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:682)
       at 
io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:617)
       at 
io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:534)
       at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:496)
       at 
io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:906)
       at 
io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
       at 
io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
       at java.lang.Thread.run(Thread.java:748)

"An existing connection was closed by the remote host"

Thats my program at the moment:


   public static void main(String[] args) {
      try (PlcConnection plcConnection = new 
PlcDriverManager().getConnection("s7://172.30.74.65/0/2")) {
          System.out.println("connected");
          System.out.println(plcConnection);
          CompletableFuture<Void> ping = plcConnection.ping();
          ping.get(500, TimeUnit.MILLISECONDS);
          System.out.println("ping exception = " + 
ping.isCompletedExceptionally());
      } catch (Exception e) {
          e.printStackTrace();
      }
      System.out.println("disconnected");
  }

I can both ping the PLC as well as connect to it with the Siemens TIA 
Portal. Does the PLC need some special configuration in the project to be 
reachable via S7Comm via ISO on TCP? nmap shows port 102 TCP as open.

Any help is much appreciated!

Mit freundlichen Grüßen
Kind regards

Sebastian Wiendl
DSE / Digital Solutions Software Engineer
Phone: +49 9605 919 - 9341
E-Mail: SWiendl@bhs-world.com
Internet: www.bhs-world.com<https://www.bhs-world.com<
https://www.bhs-world.com/>>
Shop: www.icorr.shop
________________________________
[cid:_1_14F1425C14F13E60004CB934C12584AB]

BHS Corrugated Maschinen- und Anlagenbau GmbH
Paul-Engel-Straße 1
92729 WEIHERHAMMER
GERMANY

Management: Christian Engel, Lars Engel
Registered at Amtsgericht Weiden, HR B 1320

________________________________

[cid:_2_14F15D3814F15954004CB934C12584AB]
[cid:_2_14F1632414F15F40004CB934C12584AB]
[cid:_2_14F1691014F1652C004CB934C12584AB]


[cid:_1_14F16DAC14F1667C004CB934C12584AB]







Re: Antwort: Re: Configuring a S7-1500 for Access with PLC4J

Posted by Julian Feinauer <j....@pragmaticminds.de>.
Hey,

same to you : )
Hm, thats tricky.. I think we have never seen something like that before.
The only thing I could think of is GET/PUT not being enabled (via TIA) on the PLC but I’m unsure if that’s already for the connection or only for reads.

Julian

Von: Sebastian Wiendl <SW...@bhs-corrugated.de>
Antworten an: "dev@plc4x.apache.org" <de...@plc4x.apache.org>
Datum: Donnerstag, 7. November 2019 um 15:05
An: "dev@plc4x.apache.org" <de...@plc4x.apache.org>
Betreff: Antwort: Re: Configuring a S7-1500 for Access with PLC4J

Record Response Time :-)

I had a simple read before I tried the ping - same result. I think the exception already happens during the PlcDriverManager.getConnection.

Mit freundlichen Grüßen
Kind regards

Sebastian Wiendl
DSE / Digital Solutions Software Engineer
Phone: +49 9605 919 - 9341
E-Mail: SWiendl@bhs-world.com
Internet: www.bhs-world.com<https://www.bhs-world.com>
Shop: www.icorr.shop
________________________________
 [cid:_1_14BA133414BA0F38004D60B2C12584AB]

BHS Corrugated Maschinen- und Anlagenbau GmbH
Paul-Engel-Straße 1
92729 WEIHERHAMMER
GERMANY

Management: Christian Engel, Lars Engel
Registered at Amtsgericht Weiden, HR B 1320

________________________________

[cid:_2_14BA2E1014BA2A2C004D60B2C12584AB]
[cid:_2_14BA33FC14BA3018004D60B2C12584AB]
[cid:_2_14BA39E814BA3604004D60B2C12584AB]


[cid:_1_14BA3E8414BA3754004D60B2C12584AB]




Von:        "Julian Feinauer" <j....@pragmaticminds.de>
An:        "dev@plc4x.apache.org" <de...@plc4x.apache.org>
Datum:        07.11.2019 15:01
Betreff:        Re: Configuring a S7-1500 for Access with PLC4J
________________________________



Hi Sebastian,

first of, welcome to PLC4X : )
Second, interesting Issue you have there.. I will try to reproduce it.
I think the issue is in the “ping()” method which does nothing “native” but rather uses the “ping” method of Netty’s channel handler.
It would be a better test to just do a “read()” on some Field like a Marker or something.

Could you try that?

Julian

Von: Sebastian Wiendl <SW...@bhs-corrugated.de>
Antworten an: "dev@plc4x.apache.org" <de...@plc4x.apache.org>
Datum: Donnerstag, 7. November 2019 um 14:58
An: "dev@plc4x.apache.org" <de...@plc4x.apache.org>
Betreff: Configuring a S7-1500 for Access with PLC4J

Hello everyone,

my sample program of PLC4J (very similiar to the hello world example) fails to connect to my test PLC (S7-1500):

Nov 07, 2019 2:37:51 PM io.netty.channel.DefaultChannelPipeline onUnhandledInboundException
WARNUNG: 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: Eine vorhandene Verbindung wurde vom Remotehost geschlossen
       at sun.nio.ch.SocketDispatcher.read0(Native Method)
       at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:43)
       at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:223)
       at sun.nio.ch.IOUtil.read(IOUtil.java:192)
       at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:380)
       at io.netty.buffer.PooledUnsafeDirectByteBuf.setBytes(PooledUnsafeDirectByteBuf.java:288)
       at io.netty.buffer.AbstractByteBuf.writeBytes(AbstractByteBuf.java:1125)
       at io.netty.channel.socket.nio.NioSocketChannel.doReadBytes(NioSocketChannel.java:347)
       at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:148)
       at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:682)
       at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:617)
       at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:534)
       at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:496)
       at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:906)
       at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
       at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
       at java.lang.Thread.run(Thread.java:748)

"An existing connection was closed by the remote host"

Thats my program at the moment:


   public static void main(String[] args) {
      try (PlcConnection plcConnection = new PlcDriverManager().getConnection("s7://172.30.74.65/0/2")) {
          System.out.println("connected");
          System.out.println(plcConnection);
          CompletableFuture<Void> ping = plcConnection.ping();
          ping.get(500, TimeUnit.MILLISECONDS);
          System.out.println("ping exception = " + ping.isCompletedExceptionally());
      } catch (Exception e) {
          e.printStackTrace();
      }
      System.out.println("disconnected");
  }

I can both ping the PLC as well as connect to it with the Siemens TIA Portal. Does the PLC need some special configuration in the project to be reachable via S7Comm via ISO on TCP? nmap shows port 102 TCP as open.

Any help is much appreciated!

Mit freundlichen Grüßen
Kind regards

Sebastian Wiendl
DSE / Digital Solutions Software Engineer
Phone: +49 9605 919 - 9341
E-Mail: SWiendl@bhs-world.com
Internet: www.bhs-world.com<https://www.bhs-world.com<https://www.bhs-world.com/>>
Shop: www.icorr.shop
________________________________
[cid:_1_14F1425C14F13E60004CB934C12584AB]

BHS Corrugated Maschinen- und Anlagenbau GmbH
Paul-Engel-Straße 1
92729 WEIHERHAMMER
GERMANY

Management: Christian Engel, Lars Engel
Registered at Amtsgericht Weiden, HR B 1320

________________________________

[cid:_2_14F15D3814F15954004CB934C12584AB]
[cid:_2_14F1632414F15F40004CB934C12584AB]
[cid:_2_14F1691014F1652C004CB934C12584AB]


[cid:_1_14F16DAC14F1667C004CB934C12584AB]





Antwort: Re: Configuring a S7-1500 for Access with PLC4J

Posted by Sebastian Wiendl <SW...@bhs-corrugated.de>.
Record Response Time :-)

I had a simple read before I tried the ping - same result. I think the 
exception already happens during the PlcDriverManager.getConnection.

Mit freundlichen Grüßen
Kind regards

Sebastian Wiendl
DSE / Digital Solutions Software Engineer
Phone: +49 9605 919 - 9341
E-Mail: SWiendl@bhs-world.com
Internet: www.bhs-world.com
Shop: www.icorr.shop

 

BHS Corrugated Maschinen- und Anlagenbau GmbH
Paul-Engel-Straße 1
92729 WEIHERHAMMER
GERMANY

Management: Christian Engel, Lars Engel
Registered at Amtsgericht Weiden, HR B 1320











Von:    "Julian Feinauer" <j....@pragmaticminds.de>
An:     "dev@plc4x.apache.org" <de...@plc4x.apache.org>
Datum:  07.11.2019 15:01
Betreff:        Re: Configuring a S7-1500 for Access with PLC4J



Hi Sebastian,

first of, welcome to PLC4X : )
Second, interesting Issue you have there.. I will try to reproduce it.
I think the issue is in the ?ping()? method which does nothing ?native? 
but rather uses the ?ping? method of Netty?s channel handler.
It would be a better test to just do a ?read()? on some Field like a 
Marker or something.

Could you try that?

Julian

Von: Sebastian Wiendl <SW...@bhs-corrugated.de>
Antworten an: "dev@plc4x.apache.org" <de...@plc4x.apache.org>
Datum: Donnerstag, 7. November 2019 um 14:58
An: "dev@plc4x.apache.org" <de...@plc4x.apache.org>
Betreff: Configuring a S7-1500 for Access with PLC4J

Hello everyone,

my sample program of PLC4J (very similiar to the hello world example) 
fails to connect to my test PLC (S7-1500):

Nov 07, 2019 2:37:51 PM io.netty.channel.DefaultChannelPipeline 
onUnhandledInboundException
WARNUNG: 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: Eine vorhandene Verbindung wurde vom Remotehost 
geschlossen
        at sun.nio.ch.SocketDispatcher.read0(Native Method)
        at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:43)
        at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:223)
        at sun.nio.ch.IOUtil.read(IOUtil.java:192)
        at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:380)
        at 
io.netty.buffer.PooledUnsafeDirectByteBuf.setBytes(PooledUnsafeDirectByteBuf.java:288)
        at 
io.netty.buffer.AbstractByteBuf.writeBytes(AbstractByteBuf.java:1125)
        at 
io.netty.channel.socket.nio.NioSocketChannel.doReadBytes(NioSocketChannel.java:347)
        at 
io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:148)
        at 
io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:682)
        at 
io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:617)
        at 
io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:534)
        at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:496)
        at 
io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:906)
        at 
io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
        at 
io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
        at java.lang.Thread.run(Thread.java:748)

"An existing connection was closed by the remote host"

Thats my program at the moment:


    public static void main(String[] args) {
       try (PlcConnection plcConnection = new 
PlcDriverManager().getConnection("s7://172.30.74.65/0/2")) {
           System.out.println("connected");
           System.out.println(plcConnection);
           CompletableFuture<Void> ping = plcConnection.ping();
           ping.get(500, TimeUnit.MILLISECONDS);
           System.out.println("ping exception = " + 
ping.isCompletedExceptionally());
       } catch (Exception e) {
           e.printStackTrace();
       }
       System.out.println("disconnected");
   }

I can both ping the PLC as well as connect to it with the Siemens TIA 
Portal. Does the PLC need some special configuration in the project to be 
reachable via S7Comm via ISO on TCP? nmap shows port 102 TCP as open.

Any help is much appreciated!

Mit freundlichen Grüßen
Kind regards

Sebastian Wiendl
DSE / Digital Solutions Software Engineer
Phone: +49 9605 919 - 9341
E-Mail: SWiendl@bhs-world.com
Internet: www.bhs-world.com<https://www.bhs-world.com>
Shop: www.icorr.shop
________________________________
 [cid:_1_14F1425C14F13E60004CB934C12584AB]

BHS Corrugated Maschinen- und Anlagenbau GmbH
Paul-Engel-Straße 1
92729 WEIHERHAMMER
GERMANY

Management: Christian Engel, Lars Engel
Registered at Amtsgericht Weiden, HR B 1320

________________________________

[cid:_2_14F15D3814F15954004CB934C12584AB]
[cid:_2_14F1632414F15F40004CB934C12584AB]
[cid:_2_14F1691014F1652C004CB934C12584AB]


[cid:_1_14F16DAC14F1667C004CB934C12584AB]




Re: Configuring a S7-1500 for Access with PLC4J

Posted by Julian Feinauer <j....@pragmaticminds.de>.
Hi Sebastian,

first of, welcome to PLC4X : )
Second, interesting Issue you have there.. I will try to reproduce it.
I think the issue is in the “ping()” method which does nothing “native” but rather uses the “ping” method of Netty’s channel handler.
It would be a better test to just do a “read()” on some Field like a Marker or something.

Could you try that?

Julian

Von: Sebastian Wiendl <SW...@bhs-corrugated.de>
Antworten an: "dev@plc4x.apache.org" <de...@plc4x.apache.org>
Datum: Donnerstag, 7. November 2019 um 14:58
An: "dev@plc4x.apache.org" <de...@plc4x.apache.org>
Betreff: Configuring a S7-1500 for Access with PLC4J

Hello everyone,

my sample program of PLC4J (very similiar to the hello world example) fails to connect to my test PLC (S7-1500):

Nov 07, 2019 2:37:51 PM io.netty.channel.DefaultChannelPipeline onUnhandledInboundException
WARNUNG: 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: Eine vorhandene Verbindung wurde vom Remotehost geschlossen
        at sun.nio.ch.SocketDispatcher.read0(Native Method)
        at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:43)
        at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:223)
        at sun.nio.ch.IOUtil.read(IOUtil.java:192)
        at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:380)
        at io.netty.buffer.PooledUnsafeDirectByteBuf.setBytes(PooledUnsafeDirectByteBuf.java:288)
        at io.netty.buffer.AbstractByteBuf.writeBytes(AbstractByteBuf.java:1125)
        at io.netty.channel.socket.nio.NioSocketChannel.doReadBytes(NioSocketChannel.java:347)
        at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:148)
        at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:682)
        at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:617)
        at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:534)
        at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:496)
        at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:906)
        at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
        at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
        at java.lang.Thread.run(Thread.java:748)

"An existing connection was closed by the remote host"

Thats my program at the moment:


    public static void main(String[] args) {
       try (PlcConnection plcConnection = new PlcDriverManager().getConnection("s7://172.30.74.65/0/2")) {
           System.out.println("connected");
           System.out.println(plcConnection);
           CompletableFuture<Void> ping = plcConnection.ping();
           ping.get(500, TimeUnit.MILLISECONDS);
           System.out.println("ping exception = " + ping.isCompletedExceptionally());
       } catch (Exception e) {
           e.printStackTrace();
       }
       System.out.println("disconnected");
   }

I can both ping the PLC as well as connect to it with the Siemens TIA Portal. Does the PLC need some special configuration in the project to be reachable via S7Comm via ISO on TCP? nmap shows port 102 TCP as open.

Any help is much appreciated!

Mit freundlichen Grüßen
Kind regards

Sebastian Wiendl
DSE / Digital Solutions Software Engineer
Phone: +49 9605 919 - 9341
E-Mail: SWiendl@bhs-world.com
Internet: www.bhs-world.com<https://www.bhs-world.com>
Shop: www.icorr.shop
________________________________
 [cid:_1_14F1425C14F13E60004CB934C12584AB]

BHS Corrugated Maschinen- und Anlagenbau GmbH
Paul-Engel-Straße 1
92729 WEIHERHAMMER
GERMANY

Management: Christian Engel, Lars Engel
Registered at Amtsgericht Weiden, HR B 1320

________________________________

[cid:_2_14F15D3814F15954004CB934C12584AB]
[cid:_2_14F1632414F15F40004CB934C12584AB]
[cid:_2_14F1691014F1652C004CB934C12584AB]


[cid:_1_14F16DAC14F1667C004CB934C12584AB]