diff --git a/OTDIPC/Server.cs b/OTDIPC/Server.cs index 6081e5d..7e01abf 100644 --- a/OTDIPC/Server.cs +++ b/OTDIPC/Server.cs @@ -53,6 +53,12 @@ public void SendMessage(T message) where T : struct { OnFailedWrite(); } + catch (ObjectDisposedException) { + // If we think the client's hung, we can close the connection + // while a write is in progress; this is especially common + // for ping writes. + OnFailedWrite(); + } finally { Marshal.FreeCoTaskMem(ptr);