Netty-invubator-codec-http3: server Создание потока к клиентскому нажатию данныхJAVA

Программисты JAVA общаются здесь
Anonymous
Netty-invubator-codec-http3: server Создание потока к клиентскому нажатию данных

Сообщение Anonymous »

В моем приложении Netty-Incubator-Codec-HTTP3 сервер создает новый поток для клиента, вызовет writeandflush () , но клиент не получает данные.
Клиент и сервер успешно подключают и создают начальный двунаправленный поток. Потоки, инициированные сервером, создаваемые через установленные QuicChannel, не доставляют данные клиенту, несмотря на то, что подключение осталось активным.

//server

...
try {
Bootstrap bs = new Bootstrap();
Channel channel = ....sync();
//i want to send data to client test
ScheduledExecutorService timerExecutor = new ScheduledThreadPoolExecutor(1);

timerExecutor.scheduleAtFixedRate(
() -> {
try {
hand();
} catch (InterruptedException e) {
e.printStackTrace();
}
},
5, 5, TimeUnit.SECONDS);

} finally {
group.shutdownGracefully();
}
}

private static void hand() {
//QUIC_CHANNEL_LIST :client connect to server success,server save it
for (QuicChannel quicChannel : QuicServerExample.QUIC_CHANNEL_LIST) {
//it is my protobuf
TdataProtoBuf.Tdata request = TdataProtoBuf.Tdata.newBuilder()
.setQueryKeyBlob("server-asd123123f")
.build();
NettyMessage nettyMessage = new NettyMessage("lty.TdataProtoBuf$Tdata", request, 0);
try {

// explicitly create a new stream and send data
QuicStreamChannel streamChannel = quicChannel.createStream(QuicStreamType.BIDIRECTIONAL,
new ChannelInitializer() {
@Override
protected void initChannel(QuicStreamChannel ch) {
// my Decoder and Encoder
ch.pipeline()
.addLast(new ProtocolV1Decoder())
.addLast(new ProtocolV1Encoder());
}
}).sync().getNow();

// after executed streamChannel.writeAndFlush .
//no log output include send success or send error...
streamChannel.writeAndFlush(nettyMessage).addListener(future -> {
if (future.isSuccess()) {
System.out.println("send success");
} else {
System.err.println("send error: " + future.cause());
}
});

} catch (Exception e) {
e.printStackTrace();
}

}
}



Подробнее здесь: https://stackoverflow.com/questions/794 ... -data-fail

Вернуться в «JAVA»