Exemplo n.º 1
0
 /// <summary>
 /// Disconnect this instance.
 /// </summary>
 public virtual void     Disconnect()
 {
     if (session.Connected())
     {
         session.Close();
     }
 }
Exemplo n.º 2
0
        public override Dynamic.Net.Base.INetCommand GetCommand(INetSession session, System.IO.Stream stream)
        {
            INetCommand  command = null;
            StreamReader sr      = new StreamReader(stream);
            string       header  = sr.ReadToEnd();

            if (header.StartsWith("GET ", StringComparison.OrdinalIgnoreCase))
            {
                HandshakeRequestCommand handshakeCmd = new HandshakeRequestCommand();
                if (handshakeCmd.Parse(header))
                {
                    command = handshakeCmd;
                }
            }
            else
            {
                WebSocketSession wSession = session as WebSocketSession;
                if (wSession != null && wSession.IsHandShake)
                {
                }
                else
                {
                    session.Close();
                }
            }
            return(command);
        }
Exemplo n.º 3
0
        public bool CloseSession(uint sessionID, string reason)
        {
            INetSession session = this.GetSession(sessionID);

            if (session == null)
            {
                return(false);
            }
            session.Close(true, reason);
            return(true);
        }
Exemplo n.º 4
0
 static public int Close(IntPtr l)
 {
     try {
         INetSession self = (INetSession)checkSelf(l);
         self.Close();
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }