S
snowtea
Unregistered / Unconfirmed
GUEST, unregistred user!
书上的程序里只用了tcpserver和tcpclient控件,但程序中出现了clientSocket,不知从何而来,请高人指点。
程序如下:
procedure TForm2.TcpServer1Accept(Sender: TObject;
ClientSocket: TCustomIpClient);
var
s:string;
DataThread:TclientDatathread;
begin
datathread:=Tclientdatathread.create(true);
datathread.TargetList:=memoRec.Lines ;
atathread.ListBuffer.Add('Remote host:'+clientsocket.LookupHostName(clientsocket.RemoteHost)+'('+clientsocket.RemoteHost+')');
s:=clientsocket.Receiveln;
while s<>'' do
begin
datathread.ListBuffer.Add(s);
s:=clientsocket.Receiveln;
end;
datathread.ListBuffer.Add('====end of message====');
datathread.Resume ;
end;
程序如下:
procedure TForm2.TcpServer1Accept(Sender: TObject;
ClientSocket: TCustomIpClient);
var
s:string;
DataThread:TclientDatathread;
begin
datathread:=Tclientdatathread.create(true);
datathread.TargetList:=memoRec.Lines ;
atathread.ListBuffer.Add('Remote host:'+clientsocket.LookupHostName(clientsocket.RemoteHost)+'('+clientsocket.RemoteHost+')');
s:=clientsocket.Receiveln;
while s<>'' do
begin
datathread.ListBuffer.Add(s);
s:=clientsocket.Receiveln;
end;
datathread.ListBuffer.Add('====end of message====');
datathread.Resume ;
end;