Reading a continuous stream using HTTP classes

  • Thread starter Thread starter Dave Nottage
  • Start date Start date
D

Dave Nottage

Apologies in advance if this has been asked before, although I have
attempted to find some answers via Google and haven't been able to find
anything relevant.

I am reading output from a web site that is a continuous stream of HTML
(ie the page never ends), and was wondering how I'd go about doing this
and which classes I should use. I suspect one of the classes in
question is HTTPWebRequest, using GetResponseStream of the result of
the GetResponse method.

I plan to implement reading the output from a thread, so that as
certain parts in the stream are reached, it would invoke a method
belonging to the class that owns the thread with the part of the
content that has been read.

Any help would be much appreciated.
 
Apologies in advance if this has been asked before, although I have
attempted to find some answers via Google and haven't been able to find
anything relevant.

I am reading output from a web site that is a continuous stream of HTML
(ie the page never ends), and was wondering how I'd go about doing this
and which classes I should use. I suspect one of the classes in
question is HTTPWebRequest, using GetResponseStream of the result of
the GetResponse method.

I plan to implement reading the output from a thread, so that as
certain parts in the stream are reached, it would invoke a method
belonging to the class that owns the thread with the part of the
content that has been read.

Any help would be much appreciated.

Dave,
There is an example in the Net Framework Class Libary under
HTTPWebResponse.GetResponseStream that appears to fit your
requirements. Although it just dumps the response stream
contents to the console you could adapt that to do whatever parsing
and event generation/method invocation you want instead.

Oz
 
Back
Top