/// <summary> /// Realiza la desconexión del cliente /// </summary> /// <param name="dr">Tipo de desconexión</param> public void Disconnect(EDissconnectReason dr) { bool disok = false; if (_Socket != null) { lock (_Socket) { try { _Socket.Close(); _Socket.Dispose(); } catch { } _Socket = null; disok = true; } } if (_Stream != null) { try { _Stream.Dispose(); } catch { } _Stream = null; } if (disok) { _DisconnectReason = dr; if (OnDisconnect != null) { OnDisconnect(this, dr); } } }
void RaiseOnDisconnect(XPloitSocketClient cl, EDissconnectReason dr) { if (cl == null) { return; } if (OnDisconnect != null) { OnDisconnect(this, cl, dr); } }
void Remove(XPloitSocketClient c, EDissconnectReason dr) { lock (_Clients) { int l = _Clients.Length; XPloitSocketClient[] cs = new XPloitSocketClient[l - 1]; for (int x = 0, y = 0; x < l; x++) { XPloitSocketClient o = _Clients[x]; if (o == c) { continue; } cs[y] = o; y++; } _Clients = cs; } if (c != null) { c.Disconnect(dr); } }
void _Socket_OnDisconnect(XPloitSocket sender, XPloitSocketClient client, EDissconnectReason e) { }
/// <summary> /// Realiza la desconexión del cliente /// </summary> /// <param name="dr">Tipo de desconexión</param> public void Disconnect(EDissconnectReason dr) { bool disok = false; if (_Socket != null) { lock (_Socket) { try { _Socket.Close(); _Socket.Dispose(); } catch { } _Socket = null; disok = true; } } if (_Stream != null) { try { _Stream.Dispose(); } catch { } _Stream = null; } if (disok) { _DisconnectReason = dr; if (OnDisconnect != null) OnDisconnect(this, dr); } }
void RaiseOnDisconnect(XPloitSocketClient cl, EDissconnectReason dr) { if (cl == null) return; if (OnDisconnect != null) OnDisconnect(this, cl, dr); }
void Remove(XPloitSocketClient c, EDissconnectReason dr) { lock (_Clients) { int l = _Clients.Length; XPloitSocketClient[] cs = new XPloitSocketClient[l - 1]; for (int x = 0, y = 0; x < l; x++) { XPloitSocketClient o = _Clients[x]; if (o == c) continue; cs[y] = o; y++; } _Clients = cs; } if (c != null) c.Disconnect(dr); }