J
jsqin
Unregistered / Unconfirmed
GUEST, unregistred user!
procedure TForm1.TcpServer1Accept(sender: TObject;
ClientSocket: TCustomIpClient);
var
s: string;
DataThread: TClientDataThread;
begin
// create thread
DataThread:= TClientDataThread.Create(true);
// set the TagetList to the gui list that you
// with to synch with.
DataThread.TargetList := memRecv.lines;
// Load the Threads ListBuffer
DataThread.ListBuffer.Add('*** Connection Accepted ***');
DataThread.ListBuffer.Add('Remote Host: ' + ClientSocket.LookupHostName(ClientSocket.RemoteHost) +
' (' + ClientSocket.RemoteHost + ')');
DataThread.ListBuffer.Add('===== Begin message =====');
s := ClientSocket.Receiveln;
while s <> '' do
begin
DataThread.ListBuffer.Add(s);
s := ClientSocket.Receiveln;
end;
DataThread.ListBuffer.Add('===== End of message =====');
DataThread.Resume;
end;
end.
这是Delphi中自带的demo--NetChart 的 部分代码
小弟初学,其中有一句不大明白,请教大家
DataThread.TargetList := memRecv.lines;(还没发现给memRecv.lines赋值)
这句是什么意思?
我想这个例子应该很多人都看过,我跟踪代码怎么就找不到 memrecv这个文本域接收客户端发送的字符的赋值语句呢? (比如说 MemRecv.lines:=clientSend(Str) 就这个意思把)
还有 s := ClientSocket.Receiveln;
while s <> '' do
begin
DataThread.ListBuffer.Add(s);
s := ClientSocket.Receiveln;
end;
为何要对变量s进行2次赋值呢?
ps:分数+到50分,希望大大们赐教,给小弟指点迷津!
ClientSocket: TCustomIpClient);
var
s: string;
DataThread: TClientDataThread;
begin
// create thread
DataThread:= TClientDataThread.Create(true);
// set the TagetList to the gui list that you
// with to synch with.
DataThread.TargetList := memRecv.lines;
// Load the Threads ListBuffer
DataThread.ListBuffer.Add('*** Connection Accepted ***');
DataThread.ListBuffer.Add('Remote Host: ' + ClientSocket.LookupHostName(ClientSocket.RemoteHost) +
' (' + ClientSocket.RemoteHost + ')');
DataThread.ListBuffer.Add('===== Begin message =====');
s := ClientSocket.Receiveln;
while s <> '' do
begin
DataThread.ListBuffer.Add(s);
s := ClientSocket.Receiveln;
end;
DataThread.ListBuffer.Add('===== End of message =====');
DataThread.Resume;
end;
end.
这是Delphi中自带的demo--NetChart 的 部分代码
小弟初学,其中有一句不大明白,请教大家
DataThread.TargetList := memRecv.lines;(还没发现给memRecv.lines赋值)
这句是什么意思?
我想这个例子应该很多人都看过,我跟踪代码怎么就找不到 memrecv这个文本域接收客户端发送的字符的赋值语句呢? (比如说 MemRecv.lines:=clientSend(Str) 就这个意思把)
还有 s := ClientSocket.Receiveln;
while s <> '' do
begin
DataThread.ListBuffer.Add(s);
s := ClientSocket.Receiveln;
end;
为何要对变量s进行2次赋值呢?
ps:分数+到50分,希望大大们赐教,给小弟指点迷津!