普
普愿众生
Unregistered / Unconfirmed
GUEST, unregistred user!
请教高手:我在用tcpserver控件收到客户端发来的数据时用memo来表示出来,在程序中读取memo中的第一行和第二行却什么也没有,请问这是什么原因呀![]谢谢
procedure Tmain_form.main_tcpserverAccept(Sender: TObject;
ClientSocket: TCustomIpClient);
var
s: string;
DataThread: TClientDataThread;
begin
main_TcpServer.Active := false;
memo_1.Lines.Clear;
DataThread:= TClientDataThread.Create(true);
DataThread.TargetList := memo_1.lines;
DataThread.ListBuffer.Add(ClientSocket.RemoteHost);
s := ClientSocket.Receiveln;
while s <> '' do
begin
DataThread.ListBuffer.Add(s);
s := ClientSocket.Receiveln;
end;
DataThread.Resume;
//以下两行读取memo_1的第一行和第二行,本来是有数据的却读不出来[]
label1.caption := main_memo_1.Lines[0];
label2.caption := main_memo_1.Lines[1];
main_tcpServer.Active := true;
end;
procedure Tmain_form.main_tcpserverAccept(Sender: TObject;
ClientSocket: TCustomIpClient);
var
s: string;
DataThread: TClientDataThread;
begin
main_TcpServer.Active := false;
memo_1.Lines.Clear;
DataThread:= TClientDataThread.Create(true);
DataThread.TargetList := memo_1.lines;
DataThread.ListBuffer.Add(ClientSocket.RemoteHost);
s := ClientSocket.Receiveln;
while s <> '' do
begin
DataThread.ListBuffer.Add(s);
s := ClientSocket.Receiveln;
end;
DataThread.Resume;
//以下两行读取memo_1的第一行和第二行,本来是有数据的却读不出来[]
label1.caption := main_memo_1.Lines[0];
label2.caption := main_memo_1.Lines[1];
main_tcpServer.Active := true;
end;