Commit 8473ae0b authored by 赵啸非's avatar 赵啸非

物联网1.0

parent e7d94d13
...@@ -33,14 +33,14 @@ import static com.mortals.xhx.common.key.Constant.*; ...@@ -33,14 +33,14 @@ import static com.mortals.xhx.common.key.Constant.*;
public class NettyUDPServerHandler extends SimpleChannelInboundHandler<DatagramPacket> { public class NettyUDPServerHandler extends SimpleChannelInboundHandler<DatagramPacket> {
@Value("${application.registerApiPath:/api/register}") //@Value("${application.registerApiPath:/api/register}")
private String registerApiPath; private String registerApiPath="/api/register";
@Value("${application.deviceInitApiPath:/api/deviceInit}") //@Value("${application.deviceInitApiPath:/api/deviceInit}")
private String deviceInitApiPath; private String deviceInitApiPath="/api/deviceInit";
@Value("${application.deviceUpdateApiPath:/api/deviceUpdate}") //@Value("${application.deviceUpdateApiPath:/api/deviceUpdate}")
private String deviceUpdateApiPath; private String deviceUpdateApiPath="/api/deviceUpdate";
@Value("${server.servlet.context-path:/m}") //@Value("${server.servlet.context-path:/m}")
private String servletPath; private String servletPath="/m";
private DeviceService deviceService; private DeviceService deviceService;
......
...@@ -52,7 +52,7 @@ public class UDPClientApp { ...@@ -52,7 +52,7 @@ public class UDPClientApp {
} }
}); });
try { try {
Channel channel = bootstrap.bind(7789).sync().channel(); Channel channel = bootstrap.bind(8074).sync().channel();
channel.closeFuture().sync().await(); channel.closeFuture().sync().await();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
......
...@@ -34,7 +34,7 @@ public class UDPClientHandler extends SimpleChannelInboundHandler<DatagramPacket ...@@ -34,7 +34,7 @@ public class UDPClientHandler extends SimpleChannelInboundHandler<DatagramPacket
for (int i = 0; i < 10; i++) { for (int i = 0; i < 10; i++) {
log.info("send msg:{}",i); log.info("send msg:{}",i);
ctx.writeAndFlush(new DatagramPacket(Unpooled.copiedBuffer("我在广播" + i, Charset.forName("utf-8")), ctx.writeAndFlush(new DatagramPacket(Unpooled.copiedBuffer("我在广播" + i, Charset.forName("utf-8")),
new InetSocketAddress("192.168.0.98", 7788))); new InetSocketAddress("192.168.0.216", 8074)));
try { try {
TimeUnit.SECONDS.sleep(2); TimeUnit.SECONDS.sleep(2);
} catch (InterruptedException e) { } catch (InterruptedException e) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment