Game Development Community

Using httpobject with blocking

by SDSC ITEST · in Torque Game Engine · 09/16/2008 (2:57 pm) · 1 replies

Hello,

I would like to know how to use httpobject in a blocking manner:

ie:

%myobject = httpobject();
%myobject.get(...urlstuf);
%resstring = %myobject.getvalue();

.getvalue should block and only return once all the data has been read by the onLine function.

anyone know how to do this in Torque Script without changing the engine?

Any help would be appreciated.

#1
09/17/2008 (2:58 pm)
You could make the ConsoleMethod "getValue" spin-lock, waiting on the result. Or you could have it wait on a conditional.

But, because you're calling that from script, it means you're blocking the main thread, including processing of any input events.

Unless you've already migrated networking to a background thread, this won't work.

Why do you need to be able to do this versus using the callback approach?