c++ - http post & get is blocking call? -


i see http codes in php.

i'm write http calls in c++ using curl.
wonder if http inherently blocking(opposed non-blocking).
ie, when send get/post message, thread blocked until gets response?

if it's not, there way perform non-blocking http or post curl?

thank you

http protocol, it's not inherently blocking or non-blocking. thing resembling 'blocking behavior' in http can't send 2 requests or 2 responses @ once in same pipeline - have wait request finish before sending one.

so real question blocking operations should curl - allow non-blocking io?

the answer libcurl has called 'multi interface', enables use without blocking: http://curl.haxx.se/libcurl/c/libcurl-multi.html

if prefer library that's better designed towards asynchronous io, can check out boost.asio. i've never used myself, seems popular: http://www.boost.org/doc/libs/1_46_1/doc/html/boost_asio.html


Comments