//---------------------------------------------------------------------
 public void close()
 {
     if (mSocket != null)
     {
         mSocket.close();
         mSocket = null;
     }
 }
        //---------------------------------------------------------------------
        void _onSocketError(string error)
        {
            mSocket = null;

            if (OnSocketError != null)
            {
                OnSocketError(error);
            }
        }
        //---------------------------------------------------------------------
        void _onSocketClose(SessionCloseReason reason)
        {
            mSocket = null;

            if (OnSocketClosed != null)
            {
                OnSocketClosed(reason);
            }
        }
 //---------------------------------------------------------------------
 public EntityRpcSessionSuperSocketS(EntityMgr entity_mgr, SuperSocketSession socket)
 {
     mEntityMgr = entity_mgr;
     mSocket = socket;
     mSocket.OnSocketClosed = _onSocketClose;
     mSocket.OnSocketReceive = _onSocketReceive;
     mSocket.OnSocketError = _onSocketError;
     socket.IsConnected = true;
 }