Top "Networkstream" questions

A .NET class that provides the underlying stream of data for network access.

What are some reasons NetworkStream.Read would hang/block?

MSDN documentation seems to suggest that NetworkStream.Read will always return immediately. If no data is found it returns 0. However, …

c# sockets blocking networkstream
BeginReceive / BeginRead timeouts

I'm using a NetworkStream & TcpClient to asynchronously receive data using BeginRead. I need to apply a time-out to this …

asynchronous tcpclient networkstream beginreceive beginread
How to cancel NetworkStream.ReadAsync without closing stream

I am trying to use NetworkStream.ReadAsync() to read data but I cannot find how to cancel the ReadAsync() once …

c# .net asynchronous async-await networkstream
How do you wait for a Network Stream to have data to read?

I have a worker thread in my application that is responsible for three different things. Requests for two of the …

c# multithreading networkstream
Detecting client TCP disconnection while using NetworkStream class

A friend of mine came to me with a problem: when using the NetworkStream class on the server end of …

sockets tcpclient networkstream disconnect
Does one need to close both NetworkStream and TcpClient, or just TcpClient?

I'm reading the documentation on TcpClient.Close() and noticed this: Calling this method will eventually result in the close of …

c# dispose tcpclient networkstream
C# BinaryReader.ReadChar throws "System.ArgumentException: The output char buffer is too small" when reading NetworkStream

When reading C# NetworkStream (from stream-type TCP socket), BinaryReader.ReadChar occasionally throws exceptions System.ArgumentException: The output char buffer is …

c# networkstream binaryreader
NetworkStream gets System.IO.IOException: Unable to write data to the transport connection

I am using a NetworkStream to keep an open TCP/IP connection that messages can be sent across. I receive …

c# tcp ioexception networkstream
How do I properly write Socket/NetworkStream asynchronously?

I want to use NetworkStream (or maybe Socket) to read/write TCP connections. I want to use non-blocking operations so …

c# .net sockets asynchronous networkstream
Invoke The stream does not support reading

I have a c# network application where alot of anonymous users connect to (game service). Now I check the logs …

c# exception-handling networkstream notsupportedexception