/// <summary> /// Disconnect this instance. /// </summary> public virtual void Disconnect() { if (session.Connected()) { session.Close(); } }
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); }
public bool CloseSession(uint sessionID, string reason) { INetSession session = this.GetSession(sessionID); if (session == null) { return(false); } session.Close(true, reason); return(true); }
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)); } }