Shashidhar100
Programmer
I have a an HTA client application which consists of two frames.
The top frame occupies 80% of the window and is meant for displaying, submittng or creating xml data.
The top frame is the one which communicates with a remote web server(SilverStream Server) as and when it has to post or get any xml data to and fro from the server.
The bottom frame is meant to ping the server connectivity and keep a global variable updated with some flag values to indicate the status of the server which is used by the top frame for interacting with the web server.
I've written a code for the bottom frame i.e., the pinging action for every 5 secs.
This code while testing has turned out to be very fragile and non-dependable because:
a) If the server is running when the HTA Application is started, it is giving correct results i.e., tells that server is connected.
Then we bring down the server, the HTA application is not indicating the change i.e., tells that server is still connected.
b) While making the pinging in Asynchronous mode=False, sometimes the pinging takes too much time so that the HTA client is kept hanging.
So please look at the code and suggest me some measures.
S. Shashidhar
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
<html>
<head><title>Screen</title>
<Script language="JScript">
function start()
{
intervalID=window.setInterval("getStream('}
function getStream( uri ){
document.cookie="ServerStatus=M";
Server.innerText="Server Checking ...";
try
{
var Req = new ActiveXObject("Microsoft.XMLHTTP"
Req.open("GET", uri, false);
Req.setRequestHeader("Translate","f"
Req.send();
/*
while (Req.readyState != 4)
{
Req.waitForResponse(5); //wait for the response for 5 seconds
}
*/
if(Req.status == 200)
{
document.cookie="ServerStatus=C";
Server.innerText="Server Connected";
}
else
{
document.cookie="ServerStatus=D";
Server.innerText="Server DisConnected";
}
}
catch(e)
{
document.cookie="ServerStatus=D";
Server.innerText="Server DisConnected";
}
finally
{
Req=null;
}
}
</Script>
</head>
<body bgColor="BDB76B" onLoad="return start();" Language="JScript">
<table width="100%">
<tr>
<td align="right" width="100%">
<span id="Server" style="Align:'right';color:red;font-weight:bold;fontsize='12pt'"></span>
</td>
</tr>
</table>
</body>
</html>
The top frame occupies 80% of the window and is meant for displaying, submittng or creating xml data.
The top frame is the one which communicates with a remote web server(SilverStream Server) as and when it has to post or get any xml data to and fro from the server.
The bottom frame is meant to ping the server connectivity and keep a global variable updated with some flag values to indicate the status of the server which is used by the top frame for interacting with the web server.
I've written a code for the bottom frame i.e., the pinging action for every 5 secs.
This code while testing has turned out to be very fragile and non-dependable because:
a) If the server is running when the HTA Application is started, it is giving correct results i.e., tells that server is connected.
Then we bring down the server, the HTA application is not indicating the change i.e., tells that server is still connected.
b) While making the pinging in Asynchronous mode=False, sometimes the pinging takes too much time so that the HTA client is kept hanging.
So please look at the code and suggest me some measures.
S. Shashidhar
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
<html>
<head><title>Screen</title>
<Script language="JScript">
function start()
{
intervalID=window.setInterval("getStream('}
function getStream( uri ){
document.cookie="ServerStatus=M";
Server.innerText="Server Checking ...";
try
{
var Req = new ActiveXObject("Microsoft.XMLHTTP"
Req.open("GET", uri, false);
Req.setRequestHeader("Translate","f"
Req.send();
/*
while (Req.readyState != 4)
{
Req.waitForResponse(5); //wait for the response for 5 seconds
}
*/
if(Req.status == 200)
{
document.cookie="ServerStatus=C";
Server.innerText="Server Connected";
}
else
{
document.cookie="ServerStatus=D";
Server.innerText="Server DisConnected";
}
}
catch(e)
{
document.cookie="ServerStatus=D";
Server.innerText="Server DisConnected";
}
finally
{
Req=null;
}
}
</Script>
</head>
<body bgColor="BDB76B" onLoad="return start();" Language="JScript">
<table width="100%">
<tr>
<td align="right" width="100%">
<span id="Server" style="Align:'right';color:red;font-weight:bold;fontsize='12pt'"></span>
</td>
</tr>
</table>
</body>
</html>