[Info-vax] The Future of Programming Languages and Web browsers *IS HERE*
Richard Maher
maher_rj at hotspamnotmail.com
Thu Nov 19 07:04:52 EST 2009
Hi John,
"JC" <thecookson at gmail.com> wrote in message
news:9fb84ef0-8f6c-474d-947f-0fb60f41bf3d at m33g2000vbi.googlegroups.com...
> The major concept here is synchronous programming versus Asynchronous
Then why not just set the Async flag in Ajax to "false"?
Actually, I've spent quite a bit of time coming up with an Asynchronous i/o
client example for Tier3. Some of you may recall that I'd previously used
the Socket.setSoTimeout() method to trap tardy reads and provide
quasi-aynchronous functionality. While I believe this can still be a valid
strategy, the new client provides the following SEND method: -
t3Client.send(msg, callback, async, [args...]);
If you have specified "false" for the "asynch" parameter the the Tier3Client
Applet will *not* return (and your Javascript EDT will hang/stall) until
your "callback" routine has called "this.rendezvous();". Here's a snippet
from the upcoming Tier3Client Employee_lookup.html example (empDetails is
the callback): -
function empDetails(employeeHTML)
{
recType = employeeHTML.substr(0,2);
this.rendezvous(); //*** the SEND call can now return
switch (recType)
{
case "00" :
alert(inRow.substr(2));
break;
case "11":
empDiv.innerHTML = employeeHTML.substr(2);
break;
case "99":
empDiv.innerHTML = empEOF;
break;
default:
throw new Error("Unknown record returned from Employee Lookup");
}
}
Note that on the callbacks for the Tier3Suggest functionality, the SENDs are
completely asynchronous and the List-of-Values (or result-set) pops up or
hides as needed. (You'ss see the closure on the "vintage" variable allows
the callback to discover if it's been superseded by subsequent keystrokes.
As I said "I love Javascript".)
It's all awfully clever.
> I hear that Microsoft Silverlight uses a synchronous
> model on the client side,
The first version of SilverLight MS only support Ajax and then only MS-Ajax.
Thankfully Silverlight, Like Flex, and Java before them now also support
Sockets.
> John Cookson
Regards Richard Maher
More information about the Info-vax
mailing list