多个客户端同时向一个服务端发送xml数据包
服务端用idhttpserver来接收xml数据包,现在发现服务端程序经常莫名其妙死掉!
没有任何错误提示,直接关闭!接收数据量比较大!
idhttpserver的commandget方法是这样写的:
-----------------------------------
if requestinfo.command = post then
try
coinitialize(nil);
post_data := requestinfo.params.gettext;
try
if(post_data<>)then
begin
q_so.close;
q_so.sql.clear;
q_so.sql.add(insert into +v_tbname+ select seq_pc_ods.nextval,+post_data+,0,sysdate from dual);
q_so.prepare;
q_so.execsql;
//savefile(post_data,inttostr(v_suc_num+1)+.txt);
v_suc_num := v_suc_num +1;
if memo1.lines.count>300 then
memo1.lines.clear;
memo1.lines.add(post_data);
statusbar.panels[1].text:=成功接收:+inttostr(v_suc_num)+条,接收失败:+inttostr(v_fail_num) + 条;
end;
except on e: exception do
begin
write_err_log(接收失败:+e.message);
v_fail_num:=v_fail_num+1;
responseinfo.responseno := 500;
responseinfo.contenttext := post_data;
responseinfo.contentlength := length(post_data);
couninitialize;
exit;
end;
end;
finally
couninitialize;
end;
---------------------------------
这个问题已经困扰了好几天了,有时候一两个小时,有时候几分钟后程序就自动关闭!
请高手相助! 看看我写的代码有什么问题。。。。
-
-
有可能是接收速度过快,在关闭数据库的同时又触发接收事件写数据库而造成异常关闭
发表者:cctv6012cn是啊。。。同上,怎么会有你这样的问题呢。我去看一下
发表者:ly_liuyang最好升级indy到9.0.11版了
d6/7自带的indy都有点问题的发表者:sxy_9761indydemo里面有个这样的例子
发表者:westdiamond可能在运行中的异常处理以后,httpserver断开了连接~ 你可以在里面多加active是否为false即可~