高手看看偶的代码,TCPSERVER中为什么只能Writeln一次呐?
procedure TForm1.IdTCPServer1Execute(AThread: TIdPeerThread);
Var
i:integer;
ret_k:array[0..30] of string;
read_str:string;
ygh,yhzh:string; //ygh为员工号 ,yhzh为用户帐号
timestr:string;
dhhm:string; //dhhm为用户号码
zxjg:string; //标识位
xls:string;
sendstr:string;
LABEL 10;
begin
with AThread.Connection do
begin
10: flag:='';
read_str:=Readln();
logging(file_log,'读取到'+read_str);
for i:=0 to 30 do
ret_k[i]:='';
str_dis(read_str,ret_k,'|||');
db97.StartTransaction;
flag:=ret_k[0]; //标识位
if flag='authen' then
begin
sendstr:='authen|||客户端认证|||31|||000=1|||003=0|||004=认证通过|||';
WriteLn(sendstr);
logging(file_log,'send authen');
goto 10;
end
else if flag='health' then
begin
ygh:=trimright(copy(ret_k[4],5,10)); //员工号为字段中第5位
yhzh:=copy(ret_k[6],5,5); //帐号为字段中第3位
xls:=find_xls(yhzh,db97); //由帐号查流水号
timestr:=datetostr(date)+' '+TimeToStr(time);
sendstr:='health|||用户健康档案归档|||23|||103=0|||104=归档成功|||';
//已经处理或异常的情况:包括已竣工重新发过来的和其他异常情况
if xls='-1' then
begin
zxjg:='e';
nothing_cl(timestr,' ',yhzh,timestr,ygh,zxjg,db97); //异常情况
end
else
begin
dhhm:=dhhm_sql(xls,db97); //读DHHM用户电话号码的值(可能为-1,暂不处理)
//如果完成
if process_ret(xls,ygh,db97)=0 then
begin
zxjg:='1'; //zxjg为1表示开通成功
health_cl(xls,dhhm,yhzh,timestr,ygh,zxjg,db97);
db97.commit;
logging(file_log,'successful');
end
//不完成
else
begin
zxjg:='-1'; //zxjg为-1表示开通失败
health_cl(xls,dhhm,yhzh,timestr,ygh,zxjg,db97);
db97.Rollback;
logging(file_log,'unsuccessful');
end;
end;
WriteLn(sendstr);
logging(file_log,'send health');
end;
disconnect;
end;
end;
这只是一个用于测试的代码!!只有第一次会给客户端回消息!以后就不可以的了!伤心!!偶刚刚接触INDY,高手多多指教哦!