Hi all,
I am new in protobuff... and I already need some help.
Here a simple sample I have successfuly created, a simple service which
getData from a server..
I get an error (An existing connection was forcibly closed by the remote
host), just after the client received the final acknowledgement.
It means I can not use ma servezr more than once :)
I am using, on windows7,
Java 8
protoc:3.0.0-beta-2
protoc-gen-grpc-java:0.14.0
protobuf-maven-plugin 0.5.0
grpc-netty 0.14.0
grpc-protobuf 0.14.0
grpc-stub 0.14.0
On Client Side,
ManagedChannel channel = ManagedChannelBuilder.forAddress(host, port)
.usePlaintext(true)
.build();ViewServiceGrpc.ViewServiceBlockingClient blockingStub =
ViewServiceGrpc.newBlockingStub(channel);
blockingStub.getData();
channel.shutdown();
On the server Side:
server = ServerBuilder.forPort(port).addService(ViewServiceGrpc.bindService(
new ViewServiceGrpc.ViewService() {
public void getData(View request, StreamObserver<Ack> responseObserver) {
switch (request.getDataCase()) {
responseObserver.onNext(Ack.newBuilder().setAckMessage("ACK_OK").build());
responseObserver.onCompleted();
}
})).build();
server.start();
Everything is OK, except this error on server side
juin 28, 2016 3:33:47 PM io.grpc.netty.NettyServerHandler onConnectionError
AVERTISSEMENT: Connection Error java.io.IOException: Une connexion
existante a dû être fermée par l’hôte distant 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:1054) at io.netty.channel.
socket.nio.NioSocketChannel.doReadBytes(NioSocketChannel.java:245) at io.
netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(
AbstractNioByteChannel.java:106) at io.netty.channel.nio.NioEventLoop.
processSelectedKey(NioEventLoop.java:527) at io.netty.channel.nio.
NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:484) at io.netty
.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:398) at io.
netty.channel.nio.NioEventLoop.run(NioEventLoop.java:370) at io.netty.util.
concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:
742) at io.netty.util.concurrent.
DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:
145) at java.lang.Thread.run(Thread.java:745) juin 28, 2016 3:33:47 PM io.
grpc.netty.NettyServerTransport notifyTerminated GRAVE: Transport failed
java.io.IOException: Une connexion existante a dû être fermée par l’hôte
distant 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
:1054) at io.netty.channel.socket.nio.NioSocketChannel.doReadBytes(
NioSocketChannel.java:245) at io.netty.channel.nio.
AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:106)
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:
527) at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(
NioEventLoop.java:484) at io.netty.channel.nio.NioEventLoop.
processSelectedKeys(NioEventLoop.java:398) at io.netty.channel.nio.
NioEventLoop.run(NioEventLoop.java:370) at io.netty.util.concurrent.
SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:742) at io.
netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(
DefaultThreadFactory.java:145) at java.lang.Thread.run(Thread.java:745)
Thanks for your help.
--
You received this message because you are subscribed to the Google Groups
"grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/grpc-io/43de1809-ea84-4c05-96cd-465dc430951b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.