Payne747
September 30th, 2009, 04:08 PM
Hi all,
I'm new so be kind... ;)
Wondering if anyone can give me tips\advice for C++ programming with the HTTP protocol - specifically using recv(). Basically I call recv() to get the server response, but with a persistent connection, the server never returns 0.
I'm guessing it's not possible with blocking sockets (yes... I'm still starting out!), so once the server returns the HTTP response, I'm still blocking on recv() because the server is keeping the connection open.
My question is, is it possible to use blocking sockets and still determine how much of the HTTP response is left to read (I know content-length will tell me, but my first recv() call has no way of knowing how much of the HTTP response body it already contains, unless I search for \r\n\r\n and count from there...?)
Sorry if this doesn't make much sense, even so - if anyone has any good tips for reading an entire HTTP response into a buffer, I'd appreicate it :)
Lastly, for flattery, first impressions and all - you guys have already helped me on many occasions in the past ;)
Thanks,
Payne747
I'm new so be kind... ;)
Wondering if anyone can give me tips\advice for C++ programming with the HTTP protocol - specifically using recv(). Basically I call recv() to get the server response, but with a persistent connection, the server never returns 0.
I'm guessing it's not possible with blocking sockets (yes... I'm still starting out!), so once the server returns the HTTP response, I'm still blocking on recv() because the server is keeping the connection open.
My question is, is it possible to use blocking sockets and still determine how much of the HTTP response is left to read (I know content-length will tell me, but my first recv() call has no way of knowing how much of the HTTP response body it already contains, unless I search for \r\n\r\n and count from there...?)
Sorry if this doesn't make much sense, even so - if anyone has any good tips for reading an entire HTTP response into a buffer, I'd appreicate it :)
Lastly, for flattery, first impressions and all - you guys have already helped me on many occasions in the past ;)
Thanks,
Payne747