Examples of CSocket


Examples of com.bj58.spat.gaea.client.communication.socket.CSocket

          logger.warn("This proxy server is unavailable.state:" + state + "+host:" + address);
          throw new Exception("This proxy server is unavailable.state:" + state + "+host:" + address);
        }
       
        increaseCU();
        CSocket socket = null;
        try {
            try {
              socket = this.scoketpool.getSocket();
                byte[] data = p.toBytes(socket.isRights(),socket.getDESKey());
                socket.registerRec(p.getSessionID());
                socket.send(data)
            } catch (Throwable ex) {
                logger.error("Server get socket Exception", ex);
                throw ex;
            }finally {
              if(socket != null){
                socket.dispose();
              }
            }
            byte[] buffer = socket.receive(p.getSessionID(), currUserCount);
            Protocol result = Protocol.fromBytes(buffer,socket.isRights(),socket.getDESKey());
            if (this.state == ServerState.Testing) {
                relive();
            }
            return result;
        } catch (IOException ex) {
            logger.error("io exception", ex);
            if (socket == null || !socket.connecting()) {
                if (!test()) {
                    markAsDead();
                }
            }
            throw ex;
        } catch (Throwable ex) {
            logger.error("request other Exception", ex);
            throw ex;
        } finally {
            if (state == state.Testing) {
                markAsDead();
            }
            if (socket != null) {
                socket.unregisterRec(p.getSessionID());
            }
            decreaseCU();
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.