If this is System.IO.StreamReader
, then set it on the BaseStream
:
streamReader.BaseStream.ReadTimeout = 2000; //milliseconds, so 2 seconds
More Related Contents:
- How to configure socket connect timeout
- How to add a Timeout to Console.ReadLine()?
- Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding. The statement has been terminated
- Programming P2P application
- Implement C# Generic Timeout
- Using .Net 4.5 Async Feature for Socket Programming
- Should I call Close() or Dispose() for stream objects?
- Timeouts with long running ASP.NET MVC Core Controller HTTPPost Method
- An attempt was made to access a socket in a way forbidden by its access permissions. Why?
- GPS Socket communication (CONCOX)
- What are some reasons NetworkStream.Read would hang/block?
- The operation has timed out at System.Net.HttpWebRequest.GetResponse() while sending large number of requests to a host
- Converting file into Base64String and back again
- search text file using c# and display the line number and the complete line that contains the search keyword
- C# Begin/EndReceive – how do I read large data?
- Adding a Line to the Middle of a File with .NET
- Is there a Task based replacement for System.Threading.Timer?
- How to check if a socket is connected/disconnected in C#?
- Unity: Live Video Streaming
- Streaming input to System.Speech.Recognition.SpeechRecognitionEngine
- Communicating with a socket.io server via c#
- “An operation on a socket could not be performed because the system lacked sufficient buffer space or because a queue was full”
- HTTPWebResponse + StreamReader Very Slow
- How can I get all the active TCP connections using .NET Framework (no unmanaged PE import!)?
- C# Socket.BeginReceive/EndReceive
- Implementing a timeout on a function returning a value
- Get Length of Data Available in NetworkStream
- How do I obtain the latency between server and client in C#?
- TCP server with multiple Clients
- “A connection attempt failed because the connected party did not properly respond after a period of time” using WebClient