diff --git a/src/libraries/System.Net.Sockets/src/System/Net/Sockets/NetworkStream.cs b/src/libraries/System.Net.Sockets/src/System/Net/Sockets/NetworkStream.cs index 78f87814575a6a..772ad52790e9fc 100644 --- a/src/libraries/System.Net.Sockets/src/System/Net/Sockets/NetworkStream.cs +++ b/src/libraries/System.Net.Sockets/src/System/Net/Sockets/NetworkStream.cs @@ -51,6 +51,10 @@ public NetworkStream(Socket socket, FileAccess access, bool ownsSocket) } if (!socket.Blocking) { + // Stream.Read*/Write* are incompatible with the semantics of non-blocking sockets, and + // allowing non-blocking sockets could result in non-deterministic failures from those + // operations. A developer that requires using NetworkStream with a non-blocking socket can + // temporarily flip Socket.Blocking as a workaround. throw new IOException(SR.net_sockets_blocking); } if (!socket.Connected)