コード例 #1
0
 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);
   }
 }
コード例 #2
0
 public void removeMultiSocketListener(MultiSocketListener l, MultiSocketEvent.EventType type) {
   support.removeMultiSocketListener(l, type);
 }
コード例 #3
0
 public void removeMultiSocketListener(MultiSocketListener l) {
   support.removeMultiSocketListener(l);
 }
コード例 #4
0
 public void addMultiSocketListener(MultiSocketListener l, MultiSocketEvent.EventType type) {
   support.addMultiSocketListener(l, type);
 }
コード例 #5
0
 public void addMultiSocketListener(MultiSocketListener l) {
   support.addMultiSocketListener(l);
 }