Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Help with llHTTPRequest & http_response

IBME Swindlehurst
Registered User
Join date: 5 Mar 2007
Posts: 139
05-29-2008 18:49
I am trying to make a small # (5 or less) of llHTTPRequest's in a "for loop" (all to the same URL) and when the "for loop" terminates wait for the http_response's. Most of the time it works like I expect, the http_response's come back in the same order as the requests were made.

Occasionally the http_response's are not in the same order the requsts were made.

I don't understand why. Can one of you experts explain what I am missing?
Kidd Krasner
Registered User
Join date: 1 Jan 2007
Posts: 1,938
05-29-2008 20:17
One simple possibility is that there is no requirement on a web server that it complete responses in the same order they were received. That's especially true if there's some sort of load balancing taking place, to forward the request to a particular physical server.

Similarly, there's no requirement in TCP/IP that packets being returned on different sockets (albeit to the same client) arrive in the order they were sent. This is actually true within a single connection, with the TCP/IP stack responsible for putting the packets back into the correct order.

There are probably more points at which this same phenomenon is true, depending on how the script processes are implemented.
Haruki Watanabe
llSLCrash(void);
Join date: 28 Mar 2007
Posts: 434
05-30-2008 00:34
You can't rely on the order of the incoming responses.

I'd recommend, sending one request, wait for the answer and then send the next request from within the http_request()-event.
Just like you would read the lines from a notecard...
Strife Onizuka
Moonchild
Join date: 3 Mar 2004
Posts: 5,887
05-30-2008 02:27
Haruki has the right idea. (though you *can* request multiple notecard lines all at once, I don't recommend it).
_____________________
Truth is a river that is always splitting up into arms that reunite. Islanded between the arms, the inhabitants argue for a lifetime as to which is the main river.
- Cyril Connolly

Without the political will to find common ground, the continual friction of tactic and counter tactic, only creates suspicion and hatred and vengeance, and perpetuates the cycle of violence.
- James Nachtwey
IBME Swindlehurst
Registered User
Join date: 5 Mar 2007
Posts: 139
Problem Resolved THANK YOU EVERYONE!
05-30-2008 06:39
It took a little re-working of my code to do a single requsest and then wait for that response, but all seems to work reliably now.

Thanks to all of you for taking the time to point out the error of my ways!