It all depends on TCP, the underlying HTTP protocol. The way TCP works is that data is sent in segments. Whenever a client sends a segment to a server, among the data sent there is information about how much additional data it is ready to receive. Usually this corresponds to some buffer on the client side. When a client receives some data, it also sends a segment to the server, confirming the received data.
So, assuming that the client processes the received data very slowly, the sequence of events may look like this:
- A connection is established, clients report how much data it is ready to receive.
- The server sends one or more segments to the client, the total amount of data in them does not exceed the client number, which said that it is ready to accept
- The client tells the server: I received the data that you sent me, but do not send me now.
- The client is processing some data.
- The client tells the server: you can send me more bytes of data
What does this mean with respect to GetResponse() ? When you call GetResponse() , the client sends a request, reads the HTTP response header (which usually fits into one segment, but may be more) and returns. At this point, if you do not start reading the response stream (which you receive by calling GetResponseStream() ), some data from the server is received, but only to fill the buffer. When this is full, no more data is transferred until you start reading the response stream.
svick source share