public void run() { try { server = new ServerSocket( Integer.parseInt(configProperties.getProperty("serverPort")), 0, InetAddress.getByName(configProperties.getProperty("serverIp"))); } catch (IOException e) { e.printStackTrace(); return; } int index = 1; while (true) { Socket sk = null; try { sk = server.accept(); } catch (IOException e) { e.printStackTrace(); return; } MultiSocket socket = new MultiSocket(sk, support); String username = "******" + index; index++; socket.setUsername(username); onlineUserlist.put(username, socket); MultiDatagramPacket enterPacket = MultiDatagramPacket.createEnterPacket(username); support.fireMultiSocketEvent(socket, MultiSocketEvent.EventType.ACCEPT, enterPacket); } }
public void removeMultiSocketListener(MultiSocketListener l, MultiSocketEvent.EventType type) { support.removeMultiSocketListener(l, type); }
public void removeMultiSocketListener(MultiSocketListener l) { support.removeMultiSocketListener(l); }
public void addMultiSocketListener(MultiSocketListener l, MultiSocketEvent.EventType type) { support.addMultiSocketListener(l, type); }
public void addMultiSocketListener(MultiSocketListener l) { support.addMultiSocketListener(l); }