1,最新版本vertx有udp支持,试着写一个UDP Server接收客户端发过来到心跳
import org.vertx.java.core.AsyncResult;
import org.vertx.java.core.AsyncResultHandler;
import org.vertx.java.core.Handler;
import org.vertx.java.core.buffer.Buffer;
import org.vertx.java.core.datagram.DatagramPacket;
import org.vertx.java.core.datagram.DatagramSocket;
import org.vertx.java.core.datagram.InternetProtocolFamily;
import org.vertx.java.core.logging.Logger;
import org.vertx.java.platform.Verticle;
public class HeartBeatServer extends Verticle {
Logger logger;
private static final int TS_SIZE = 8;
private static final int CMD_SIZE = 1;
private static final int UID_SIZE = 4;
private static final int TS_IDX = 0;
private static final int CMD_IDX = TS_SIZE;
private static final int UID_IDX = TS_SIZE + CMD_SI