L
loadme
Unregistered / Unconfirmed
GUEST, unregistred user!
小弟用idtcpclient/idtcpserver做了一个小的数据传送的程序,
在客户端用:
with idtcpclt do
begin
try
OpenWriteBuffer;
try
if not connected then connect;
writebuffer(msendbuf,102400,true);
except
on e:exception do
begin
showmessage(e.Message);
end;
end;
finally
if idtcpclt.Connected then
begin
ClearWriteBuffer;
CloseWriteBuffer;
disconnect;
end;
end;
在服务器端:
procedure Tfrmserver.IdTCPServerExecute(AThread: TIdPeerThread);
begin
//接收客户端发送来的请求报文
fillchar(mrecvbuf,sizeof(mrecvbuf),#0);
athread.Connection.ReadBuffer(mrecvbuf,sizeof(mrecvbuf));
recvxml:=mrecvbuf;
memorecv.Text:=trim(recvxml);
end;
为什么接收不到数据呢?
在客户端用:
with idtcpclt do
begin
try
OpenWriteBuffer;
try
if not connected then connect;
writebuffer(msendbuf,102400,true);
except
on e:exception do
begin
showmessage(e.Message);
end;
end;
finally
if idtcpclt.Connected then
begin
ClearWriteBuffer;
CloseWriteBuffer;
disconnect;
end;
end;
在服务器端:
procedure Tfrmserver.IdTCPServerExecute(AThread: TIdPeerThread);
begin
//接收客户端发送来的请求报文
fillchar(mrecvbuf,sizeof(mrecvbuf),#0);
athread.Connection.ReadBuffer(mrecvbuf,sizeof(mrecvbuf));
recvxml:=mrecvbuf;
memorecv.Text:=trim(recvxml);
end;
为什么接收不到数据呢?