diff --git a/uia.comm/src/main/java/uia/comm/SocketServer.java b/uia.comm/src/main/java/uia/comm/SocketServer.java index 47b172d..9ab86c4 100644 --- a/uia.comm/src/main/java/uia/comm/SocketServer.java +++ b/uia.comm/src/main/java/uia/comm/SocketServer.java @@ -650,18 +650,21 @@ private void running() { } + // 1. find out channels ready to work Iterator iter = this.serverSelector.selectedKeys().iterator(); while (iter.hasNext()) { SelectionKey key = iter.next(); iter.remove(); try { + // 1. ready to accept a new connection if (key.isAcceptable()) { ServerSocketChannel client = (ServerSocketChannel) key.channel(); SocketChannel ch = client.accept(); clientConnected(ch); } - else if (key.isReadable()) { + // 2. ready to read data + if (key.isReadable()) { SocketDataController controller = (SocketDataController) key.attachment(); if (!controller.receive()) { logger.debug(String.format("%s> %s> try to disconnect(running)", diff --git a/uia.comm/src/main/java/uia/comm/Version.java b/uia.comm/src/main/java/uia/comm/Version.java new file mode 100644 index 0000000..bc91cee --- /dev/null +++ b/uia.comm/src/main/java/uia/comm/Version.java @@ -0,0 +1,7 @@ +package uia.comm; + +public interface Version { + + public static final String NO = "20190114A"; + +}