Hey folks,
So I've been using the BlitzMax/cURL mod that Brucey put up, and it's been awesome. I've been working on a multiplayer game, and its awesome being able to deal with the less time-sensitive data transfers over simple HTTP as opposed to doing a low-level socket transfer.
I'm having trouble getting getting cURL to operate asynchronously by using the multi-interface, and I believe my problem stems from not understanding how to use the multiSelect() command.
Currently what I do is
a) create my multihandle
b) prepare my individual easy handles
c) call multiPerform() on the multihandle
d) check the return value of multiPerform(), as well as monitor how many running connections are in the variable it takes as an argument
No where do I use multiSelect(), mainly because I don't see why I should have to if multiPerform() can tell me if there is more data to be retrieved.
What I've noticed though is that it is possible for multiPerform(running) to return CURLM_OK event though running > 0. This perplexed me because it looks like cURL finished processing the HTTP requests, yet still has pending operations lingering.
Looking at the sample code, I notice they suggest the following usage:
I don't understand the usage of multiSelect(), and the documentation doesn't give much details on what exactly its purpose is, or how necessary it is. Additionally, I don't get why we perform several while loops on the same multi handle in order to complete *one* multi request. My understanding that you call multiPerform() as many times as you need until you get CURLM_OK, apparently that's not the case.
Can someone help me out with this?
Thanks,
Jason
So I've been using the BlitzMax/cURL mod that Brucey put up, and it's been awesome. I've been working on a multiplayer game, and its awesome being able to deal with the less time-sensitive data transfers over simple HTTP as opposed to doing a low-level socket transfer.
I'm having trouble getting getting cURL to operate asynchronously by using the multi-interface, and I believe my problem stems from not understanding how to use the multiSelect() command.
Currently what I do is
a) create my multihandle
b) prepare my individual easy handles
c) call multiPerform() on the multihandle
d) check the return value of multiPerform(), as well as monitor how many running connections are in the variable it takes as an argument
No where do I use multiSelect(), mainly because I don't see why I should have to if multiPerform() can tell me if there is more data to be retrieved.
What I've noticed though is that it is possible for multiPerform(running) to return CURLM_OK event though running > 0. This perplexed me because it looks like cURL finished processing the HTTP requests, yet still has pending operations lingering.
Looking at the sample code, I notice they suggest the following usage:
' start performing the request Local status:Int = multi.multiPerform(running) While status = CURLM_CALL_MULTI_PERFORM status = multi.multiPerform(running) Wend 'QUESTION!!!! How is status = CURLM_OK but process still running? While running And status = CURLM_OK ' wait for network If multi.multiSelect() <> -1 Then ' pull in any new data, or at least handle timeouts 'QUESTION!!! Why do we repeat calling multiPerform() all over again? Which call is the "real" call? status = multi.multiPerform(running) While status = CURLM_CALL_MULTI_PERFORM status = multi.multiPerform(running) Wend End If Wend
I don't understand the usage of multiSelect(), and the documentation doesn't give much details on what exactly its purpose is, or how necessary it is. Additionally, I don't get why we perform several while loops on the same multi handle in order to complete *one* multi request. My understanding that you call multiPerform() as many times as you need until you get CURLM_OK, apparently that's not the case.
Can someone help me out with this?
Thanks,
Jason