コード例 #1
0
 /**
  * 停止服务
  *
  * @throws Exception
  */
 public void stop() throws Exception {
   receiver.stop();
   sender.stop();
   try {
     receiverThread.join();
   } catch (Exception e) {
     e.printStackTrace();
   }
   try {
     senderThread.join();
   } catch (Exception e) {
     e.printStackTrace();
   }
   try {
     antenna.socket().close();
   } catch (Exception e) {
   }
   try {
     antenna.close();
   } catch (Exception e) {
   }
 }
コード例 #2
0
 /**
  * 发送服务端消息
  *
  * @param message
  * @return
  * @throws Exception
  */
 public boolean send(ServerMessage message) throws Exception {
   return sender.send(message);
 }