Hi flashpot - thanks for the reply.
PageReceived() works beautifully in Net
WebClient, however I am using Net
SimpleClient, which is a lot more Spartan that the WebClient.
AFAIK - NetSimpleClient fires the Process() method each time a packet of data comes in, which is fine, however, I have no idea when the last packet is received, unless the connection eventually times out. If there was some way to work out which packet finishes the stream then it would all be fine and dandy. I thought that putting the cleanup code in ConnectionClosed() method would work, but it looks like the Amazon server uses persistent connections and keeps it open until I close it - which is difficult to do if I am not sure when to close it in the first place!!
This is regardless of whether I include the "Connection: close" header line when sending my request.
It looks like I will have to parse the returned header to find out the "Content-Length" property and check that against the data downloaded to see if I have got it all. What makes this harder is that Amazon returns some requests as "chunked" data which means I have to wait until it sends me a zero size chunk command, which can be in the middle of the second last packet....aaaargh!
Making this even harder is that there is no way to separate the returned header from the data in NetSimpleClient. I will have to manually parse the first packet to split the header out and identify each line.
I wonder how hard it would be to hack the code and try to inherit some of the NetWebClient methods into my NetSimpleClient object?!?!?!?!
Cheers,
Devan