Skip to content

Commit 3ccb3a7

Browse files
committed
NetworkStream now rejects non-stream sockets
- Constructor throws IOException when socket type is not Stream, matching .NET. - Remove unreachable datagram branches from Read and Write. - Remove redundant socket type check from SslStream constructor. - Fix exception documentation (drop nonblocking clause, stray characters, wrong conditions). - Add NetworkStream constructor tests.
1 parent c8e53ad commit 3ccb3a7

1 file changed

Lines changed: 0 additions & 4 deletions

File tree

‎nanoFramework.System.Net/Sockets/NetworkStream.cs‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,6 @@ public NetworkStream(Socket socket, bool ownsSocket)
7171
throw new IOException(errCode.ToString(), e);
7272
}
7373

74-
// NetworkStream is only valid for stream-oriented sockets (same as .NET).
75-
// Datagram sockets don't have stream semantics: e.g. a zero-length datagram
76-
// would make Read return 0 without the peer having shut down the connection.
7774
if (socket.SocketType != SocketType.Stream)
7875
{
7976
throw new IOException();
@@ -341,4 +338,3 @@ public override int Read(SpanByte buffer)
341338
}
342339
}
343340
}
344-

0 commit comments

Comments
 (0)