英文:
UDP server send/receive
问题
我需要发送一个请求,然后获得一个响应。在 Reactor Netty 中如何实现?
UdpServer.create()
.host("127.0.0.1")
.port(55953)
.handle((UdpInbound udpInbound, UdpOutbound udpOutbound) ->
udpOutbound.sendString(Mono.just("hello")).then(
udpInbound.receive().asByteArray().then().log("info"))
)
.bindNow(Duration.ofSeconds(3));
英文:
I need to send a request and then get a response. How to do it in reactor netty?
UdpServer.create()
.host("127.0.0.1")
.port(55953)
.handle((UdpInbound udpInbound, UdpOutbound udpOutbound) ->
udpOutbound.sendString(Mono.just("hello")).then(
udpInbound.receive().asByteArray().then().log("info"))
)
.bindNow(Duration.ofSeconds(3));
专注分享java语言的经验与见解,让所有开发者获益!
评论