pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/server/forTcp/TcpSessionCache.java
@@ -124,6 +124,27 @@ return null ; } } /** * 得到所有在线与离线数量统计 * @return [0]=在线数量,[2]上线过,但当前离线的数量 */ public static Integer[] allOnLineStateStatistics(){ synchronized (sessionTable){ Integer[] arr = new Integer[]{0, 0} ; Iterator<Entry<String, TcpSession>> it = sessionTable.entrySet().iterator() ; Entry<String, TcpSession> entry = null ; while(it.hasNext()){ entry = it.next() ; if(entry.getValue().ioSession.isConnected()){ arr[0]++ ; }else{ arr[1]++ ; } } return arr ; } } /** * 得到所有在线情况