Netty udp给指定客户端发消息

udp server

package com.example.demo.udp;

import io.netty.bootstrap.Bootstrap;
import io.netty.channel.ChannelOption;
import io.netty.channel.EventLoopGroup;
import io.netty.channel.FixedRecvByteBufAllocator;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.socket.nio.NioDatagramChannel;

/**
 * A UDP server that responds to the QOTM (quote of the moment) request to a {@link UdpClient}.
 * 

* Inspired by the official * Java tutorial. */ public final class UdpServer { private static final int PORT = Integer.parseInt(System.getProperty("port", "7686")); public static void main(String[] args) throws Exception { EventLoopGroup group = new NioEventLoopGroup(); try { Bootstrap b = new Bootstrap(); b.group(group)

你可能感兴趣的:(udp,网络协议,网络)