UDP服务器发送/接收

huangapple 未分类评论45阅读模式
英文:

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));

huangapple
  • 本文由 发表于 2020年4月8日 22:01:11
  • 转载请务必保留本文链接:https://java.coder-hub.com/61102559.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定