Lets say that I use HttpWebRequest to call a web-service written in python and that service returns a XML file. Lets assume that it takes 10 seconds to download the data.
HttpWebResponse response = (HttpWebResponse)req.GetResponse();
if(allDate100%Transfered)
MsgBox.show("u can now CUT your cable. All data is there!!!");
Are there any property to check if everything have been transferred?
Because I want to proceed and for example read the received data into a string, but only when all data have been downloaded successfully.
Stream dataStream = response.GetResponseStream();
StreamReader reader = new StreamReader(dataStream);
String xml = reader.ReadToEnd();
Do I get any message or sign from the webservice, which tells me that all data is really there and I do not need the connection anymore?
Edit: The problem is stil there. I get different answers and they contradict each other.
request.GetResponse()is synchronous which means that it doesn’t return until all data have been downloaded.The documentation of
request.GetResponse()states thatWebExceptionis thrown if:Which means that everything went OK if no exception was thrown.