Region
I developed Wrapper for the Http Web Request class for more convenient execution of Gets and Posts. This library has been used without any problems for more than two years, but today we have a strange problem.
There’s one website (it will take some time to load), which, apparently, saves streaming characters in the HTML interface, so our library “Get” the request gets stuck in a loop.
Various timeout properties
Looking for a link to the Http Web Request, we find that there are two different timeout properties. We use both of them, but none of them seem to cancel properly.
- Read Write Timeout - Gets or sets the timeout in milliseconds when writing or reading from a stream.
- Timeout - Gets or sets the timeout value in milliseconds for the GetResponse and GetRequestStream methods.
One timeout for their proper management
Is there a way to set an “Operation Timeout” that will cause the thread / connection to be deleted after some pre-configured time?
Code example
public class Program { public static void Main() { string url = "http://anus.io"; Console.WriteLine("Initializing Request State Object"); RequestState myRequestState = new RequestState();
This code works fine , but how do I read the response as a string, as it is constantly being transmitted (as the browser shows)?
Question
How can these sites be handled? (By pen, I mean the ability to identify and skip situations when the server simply does not stop transmitting?)
source share