Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/306.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 如何在Spring Boot中实现UDP服务器从客户端读取输入_Java_Spring_Spring Mvc_Udp - Fatal编程技术网

Java 如何在Spring Boot中实现UDP服务器从客户端读取输入

Java 如何在Spring Boot中实现UDP服务器从客户端读取输入,java,spring,spring-mvc,udp,Java,Spring,Spring Mvc,Udp,我已经用SpringBoot(版本1.5.3)框架实现了一个web应用程序。现在我需要一个udp服务器来接收来自客户端的传入消息。如何将此功能添加到基于spring boot的项目中 我遵循链接作为参考,但无法获得w.r.t spring引导 有人能帮我理解这个吗 谢谢 Maruthy依赖于spring引导集成和spring ip <dependency> <groupId>org.springframework.boot</groupId&

我已经用SpringBoot(版本1.5.3)框架实现了一个web应用程序。现在我需要一个udp服务器来接收来自客户端的传入消息。如何将此功能添加到基于spring boot的项目中

我遵循链接作为参考,但无法获得w.r.t spring引导

有人能帮我理解这个吗

谢谢
Maruthy依赖于spring引导集成和spring ip

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-integration</artifactId>
    </dependency>

    <dependency>
        <groupId>org.springframework.integration</groupId>
        <artifactId>spring-integration-ip</artifactId>
        <version>5.1.0.RELEASE</version>
    </dependency>
还可以使用使用“UnicastSendingMessageHandler”的简单客户端将消息发送到UDP服务器

UnicastSendingMessageHandler handler =
      new UnicastSendingMessageHandler("localhost", 11111);

String payload = "Hello world";
handler.handleMessage(MessageBuilder.withPayload(payload).build());
UnicastSendingMessageHandler handler =
      new UnicastSendingMessageHandler("localhost", 11111);

String payload = "Hello world";
handler.handleMessage(MessageBuilder.withPayload(payload).build());