公司的一个wap网站使用tomact服务,但最近运行总是崩溃,有时候会在半夜,解决起来实在麻烦,所以捡起以前的delphi,写了个工具。其中思路是:
网站里写了一个jsp网页,啥也不做,用来被检测网站是否正常。使用idhttp访问,根据返回码来判断网站是否正常。不正常则重启。
故有以下几个关键:
jsp网页:
code
-------------------------------------------------------------------------
<%
String S="Rany.ok";
out.println(S.length());
%>
-------------------------------------------------------------------------
建立delphi工程,放一个timer检测。
---------------------函数-检测是否网站状态正常----------------------------------
function gethttptrue(ihttp: string):Boolean;
begin
try
idhtpwap.Get(ihttp);
if not (idhtpwap.ResponseCode > 299) then
Result:= True;
except
Result:= False;
end;
end;
--------------------------------------------------------------