Hello all,

we're trying to replace our old style native INAT library by using a pure Java 
PLC library.
I'm trying to connect to our S7-400 PLC but the PLC terminates the connection 
after the first message sent.
As URL I've used the following:
s7://192.168.3.166/0/3

Earlier we used the TSAP 0x0303 for connecting to the PLC by using a native 
library. Here is the Log output:

07:54:09.976 [main] INFO org.apache.plc4x.java.PlcDriverManager - Instantiating 
new PLC Driver Manager with class loader 
sun.misc.Launcher$AppClassLoader@73d16e93
07:54:09.992 [main] INFO org.apache.plc4x.java.PlcDriverManager - Registering 
available drivers...
07:54:09.992 [main] INFO org.apache.plc4x.java.PlcDriverManager - Registering 
driver for Protocol s7 (Siemens S7 (Basic))
07:54:10.026 [main] DEBUG io.netty.util.internal.logging.InternalLoggerFactory 
- Using SLF4J as the default logging framework
07:54:10.032 [main] DEBUG io.netty.util.ResourceLeakDetector - 
-Dio.netty.leakDetection.level: simple
07:54:10.032 [main] DEBUG io.netty.util.ResourceLeakDetector - 
-Dio.netty.leakDetection.targetRecords: 4
07:54:10.042 [main] DEBUG io.netty.util.internal.PlatformDependent - Platform: 
Windows
07:54:10.042 [main] DEBUG io.netty.util.internal.PlatformDependent0 - 
-Dio.netty.noUnsafe: false
07:54:10.042 [main] DEBUG io.netty.util.internal.PlatformDependent0 - Java 
version: 8
07:54:10.042 [main] DEBUG io.netty.util.internal.PlatformDependent0 - 
sun.misc.Unsafe.theUnsafe: available
07:54:10.042 [main] DEBUG io.netty.util.internal.PlatformDependent0 - 
sun.misc.Unsafe.copyMemory: available
07:54:10.042 [main] DEBUG io.netty.util.internal.PlatformDependent0 - 
java.nio.Buffer.address: available
07:54:10.042 [main] DEBUG io.netty.util.internal.PlatformDependent0 - direct 
buffer constructor: available
07:54:10.042 [main] DEBUG io.netty.util.internal.PlatformDependent0 - 
java.nio.Bits.unaligned: available, true
07:54:10.042 [main] DEBUG io.netty.util.internal.PlatformDependent0 - 
jdk.internal.misc.Unsafe.allocateUninitializedArray(int): unavailable prior to 
Java9
07:54:10.042 [main] DEBUG io.netty.util.internal.PlatformDependent0 - 
java.nio.DirectByteBuffer.<init>(long, int): available
07:54:10.042 [main] DEBUG io.netty.util.internal.PlatformDependent - 
sun.misc.Unsafe: available
07:54:10.042 [main] DEBUG io.netty.util.internal.PlatformDependent - 
-Dio.netty.tmpdir: C:\Users\fp\AppData\Local\Temp (java.io.tmpdir)
07:54:10.042 [main] DEBUG io.netty.util.internal.PlatformDependent - 
-Dio.netty.bitMode: 64 (sun.arch.data.model)
07:54:10.042 [main] DEBUG io.netty.util.internal.PlatformDependent - 
-Dio.netty.maxDirectMemory: 3784310784 bytes
07:54:10.042 [main] DEBUG io.netty.util.internal.PlatformDependent - 
-Dio.netty.uninitializedArrayAllocationThreshold: -1
07:54:10.058 [main] DEBUG io.netty.util.internal.CleanerJava6 - 
java.nio.ByteBuffer.cleaner(): available
07:54:10.058 [main] DEBUG io.netty.util.internal.PlatformDependent - 
-Dio.netty.noPreferDirect: false
07:54:10.059 [main] DEBUG io.netty.util.ResourceLeakDetectorFactory - Loaded 
default ResourceLeakDetector: io.netty.util.ResourceLeakDetector@136432db
07:54:10.059 [main] DEBUG io.netty.util.internal.PlatformDependent - 
org.jctools-core.MpscChunkedArrayQueue: available
07:54:10.143 [main] INFO org.apache.plc4x.java.s7.connection.S7PlcConnection - 
Setting up S7 Connection with: host-name 192.168.3.166, rack 0, slot 0, 
pdu-size 1024, max-amq-caller 8, max-amq-callee 8
07:54:10.159 [main] DEBUG io.netty.channel.MultithreadEventLoopGroup - 
-Dio.netty.eventLoopThreads: 16
07:54:10.176 [main] DEBUG io.netty.util.internal.InternalThreadLocalMap - 
-Dio.netty.threadLocalMap.stringBuilder.initialSize: 1024
07:54:10.176 [main] DEBUG io.netty.util.internal.InternalThreadLocalMap - 
-Dio.netty.threadLocalMap.stringBuilder.maxSize: 4096
07:54:10.193 [main] DEBUG io.netty.channel.nio.NioEventLoop - 
-Dio.netty.noKeySetOptimization: false
07:54:10.193 [main] DEBUG io.netty.channel.nio.NioEventLoop - 
-Dio.netty.selectorAutoRebuildThreshold: 512
07:54:10.275 [main] DEBUG io.netty.channel.DefaultChannelId - 
-Dio.netty.processId: 9024 (auto-detected)
07:54:10.276 [main] DEBUG io.netty.util.NetUtil - -Djava.net.preferIPv4Stack: 
false
07:54:10.276 [main] DEBUG io.netty.util.NetUtil - 
-Djava.net.preferIPv6Addresses: false
07:54:10.933 [main] DEBUG io.netty.util.NetUtil - Loopback interface: lo 
(Software Loopback Interface 1, 127.0.0.1)
07:54:10.936 [main] DEBUG io.netty.util.NetUtil - Failed to get SOMAXCONN from 
sysctl and file \proc\sys\net\core\somaxconn. Default: 200
07:54:11.609 [main] DEBUG io.netty.channel.DefaultChannelId - 
-Dio.netty.machineId: 00:50:b6:ff:fe:26:ae:1f (auto-detected)
07:54:11.634 [main] DEBUG io.netty.buffer.PooledByteBufAllocator - 
-Dio.netty.allocator.numHeapArenas: 16
07:54:11.634 [main] DEBUG io.netty.buffer.PooledByteBufAllocator - 
-Dio.netty.allocator.numDirectArenas: 16
07:54:11.634 [main] DEBUG io.netty.buffer.PooledByteBufAllocator - 
-Dio.netty.allocator.pageSize: 8192
07:54:11.634 [main] DEBUG io.netty.buffer.PooledByteBufAllocator - 
-Dio.netty.allocator.maxOrder: 11
07:54:11.634 [main] DEBUG io.netty.buffer.PooledByteBufAllocator - 
-Dio.netty.allocator.chunkSize: 16777216
07:54:11.634 [main] DEBUG io.netty.buffer.PooledByteBufAllocator - 
-Dio.netty.allocator.tinyCacheSize: 512
07:54:11.634 [main] DEBUG io.netty.buffer.PooledByteBufAllocator - 
-Dio.netty.allocator.smallCacheSize: 256
07:54:11.634 [main] DEBUG io.netty.buffer.PooledByteBufAllocator - 
-Dio.netty.allocator.normalCacheSize: 64
07:54:11.634 [main] DEBUG io.netty.buffer.PooledByteBufAllocator - 
-Dio.netty.allocator.maxCachedBufferCapacity: 32768
07:54:11.634 [main] DEBUG io.netty.buffer.PooledByteBufAllocator - 
-Dio.netty.allocator.cacheTrimInterval: 8192
07:54:11.634 [main] DEBUG io.netty.buffer.PooledByteBufAllocator - 
-Dio.netty.allocator.cacheTrimIntervalMillis: 0
07:54:11.634 [main] DEBUG io.netty.buffer.PooledByteBufAllocator - 
-Dio.netty.allocator.useCacheForAllThreads: true
07:54:11.634 [main] DEBUG io.netty.buffer.PooledByteBufAllocator - 
-Dio.netty.allocator.maxCachedByteBuffersPerChunk: 1023
07:54:11.634 [main] DEBUG io.netty.buffer.ByteBufUtil - 
-Dio.netty.allocator.type: pooled
07:54:11.634 [main] DEBUG io.netty.buffer.ByteBufUtil - 
-Dio.netty.threadLocalDirectBufferSize: 0
07:54:11.634 [main] DEBUG io.netty.buffer.ByteBufUtil - 
-Dio.netty.maxThreadLocalCharBufferSize: 16384
07:54:11.676 [nioEventLoopGroup-2-1] DEBUG 
org.apache.plc4x.java.isotp.protocol.IsoTPProtocol - ISO Transport Protocol 
Sending Connection Request
07:54:11.693 [nioEventLoopGroup-2-1] DEBUG io.netty.buffer.AbstractByteBuf - 
-Dio.netty.buffer.checkAccessible: true
07:54:11.693 [nioEventLoopGroup-2-1] DEBUG io.netty.buffer.AbstractByteBuf - 
-Dio.netty.buffer.checkBounds: true
07:54:11.693 [nioEventLoopGroup-2-1] DEBUG 
io.netty.util.ResourceLeakDetectorFactory - Loaded default 
ResourceLeakDetector: io.netty.util.ResourceLeakDetector@68818334
07:54:11.693 [nioEventLoopGroup-2-1] DEBUG io.netty.util.Recycler - 
-Dio.netty.recycler.maxCapacityPerThread: 4096
07:54:11.693 [nioEventLoopGroup-2-1] DEBUG io.netty.util.Recycler - 
-Dio.netty.recycler.maxSharedCapacityFactor: 2
07:54:11.693 [nioEventLoopGroup-2-1] DEBUG io.netty.util.Recycler - 
-Dio.netty.recycler.linkCapacity: 16
07:54:11.693 [nioEventLoopGroup-2-1] DEBUG io.netty.util.Recycler - 
-Dio.netty.recycler.ratio: 8
07:54:11.693 [nioEventLoopGroup-2-1] DEBUG 
org.apache.plc4x.java.isoontcp.protocol.IsoOnTcpProtocol - ISO on TCP Message 
sent
07:54:11.708 [nioEventLoopGroup-2-1] WARN 
io.netty.channel.DefaultChannelPipeline - 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.PooledByteBuf.setBytes(PooledByteBuf.java:247)
       at io.netty.buffer.AbstractByteBuf.writeBytes(AbstractByteBuf.java:1140)
       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:697)
       at 
io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:632)
       at 
io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:549)
       at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:511)
       at 
io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:918)
       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:745)
org.apache.plc4x.java.api.exceptions.PlcConnectionException: 
java.util.concurrent.ExecutionException: 
org.apache.plc4x.java.api.exceptions.PlcIoException: Connection terminated by 
remote
       at 
org.apache.plc4x.java.base.connection.NettyPlcConnection.connect(NettyPlcConnection.java:88)
       at 
org.apache.plc4x.java.PlcDriverManager.getConnection(PlcDriverManager.java:73)
       at test.ReadValue.main(ReadValue.java:22)
Caused by: java.util.concurrent.ExecutionException: 
org.apache.plc4x.java.api.exceptions.PlcIoException: Connection terminated by 
remote
       at 
java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:357)
       at 
java.util.concurrent.CompletableFuture.get(CompletableFuture.java:1895)
       at 
org.apache.plc4x.java.base.connection.NettyPlcConnection.connect(NettyPlcConnection.java:79)
       ... 2 more
Caused by: org.apache.plc4x.java.api.exceptions.PlcIoException: Connection 
terminated by remote
       at 
org.apache.plc4x.java.base.connection.NettyPlcConnection.lambda$connect$0(NettyPlcConnection.java:70)
       at 
io.netty.util.concurrent.DefaultPromise.notifyListener0(DefaultPromise.java:500)
       at 
io.netty.util.concurrent.DefaultPromise.notifyListenersNow(DefaultPromise.java:474)
       at 
io.netty.util.concurrent.DefaultPromise.notifyListeners(DefaultPromise.java:413)
       at 
io.netty.util.concurrent.DefaultPromise.setValue0(DefaultPromise.java:538)
       at 
io.netty.util.concurrent.DefaultPromise.setSuccess0(DefaultPromise.java:527)
       at 
io.netty.util.concurrent.DefaultPromise.trySuccess(DefaultPromise.java:98)
       at 
io.netty.channel.DefaultChannelPromise.trySuccess(DefaultChannelPromise.java:84)
       at 
io.netty.channel.AbstractChannel$CloseFuture.setClosed(AbstractChannel.java:1156)
       at 
io.netty.channel.AbstractChannel$AbstractUnsafe.doClose0(AbstractChannel.java:758)
       at 
io.netty.channel.AbstractChannel$AbstractUnsafe.close(AbstractChannel.java:734)
       at 
io.netty.channel.AbstractChannel$AbstractUnsafe.close(AbstractChannel.java:605)
       at 
io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.closeOnRead(AbstractNioByteChannel.java:105)
       at 
io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.handleReadException(AbstractNioByteChannel.java:127)
       at 
io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:174)
       at 
io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:697)
       at 
io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:632)
       at 
io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:549)
       at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:511)
       at 
io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:918)
       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:745)

Any ideas why this does not work? What options can I try to make this work? May 
be the rack/slot be is wrong?

Looking forward for your help!

Kind regards,
Florian

Reply via email to