///<summary>Sends a reply to the client connection and disposes it afterwards.</summary> ///<param name="Value">A byte that contains the reply code to send to the client.</param> protected override async Task Dispose(ReplyCode Value) { byte[] ToSend; try { ToSend = new byte[] { 0, (byte)Value, (byte)(Math.Floor(((IPEndPoint)RemoteConnection.RemoteEndPoint).Port / 256.0)), (byte)(((IPEndPoint)RemoteConnection.RemoteEndPoint).Port % 256), (byte)(Math.Floor((IPHelper.Endpoint2Int(RemoteConnection.RemoteEndPoint) % 256.0))), (byte)(Math.Floor((IPHelper.Endpoint2Int(RemoteConnection.RemoteEndPoint) % 65536) / 256.0)), (byte)(Math.Floor((IPHelper.Endpoint2Int(RemoteConnection.RemoteEndPoint) % 16777216) / 65536.0)), (byte)(Math.Floor(IPHelper.Endpoint2Int(RemoteConnection.RemoteEndPoint) / 16777216.0)) }; } catch { ToSend = new byte[] { 0, 91, 0, 0, 0, 0, 0, 0 }; } try { await Connection.SendAsync(ToSend, (ToSend[1] == 90 ? (Action <int>)OnDisposeGood : OnDisposeBad)); } catch { await Dispose(false); } }