使用server socket多线程接收数据的问题
procedure TMyClientThread.Execute;
var
TheStream: TWinSocketStream;
buffer: string;
begin
{ create a TWinSocketStream for reading and writing }
TheStream := TWinSocketStream.Create(ClientSocket.Socket, 60000);
try
FillChar(Data179R, SizeOf(Data179R), 0); //初始化 初始化缓冲区
while (not Terminated) and (ClientSocket.Active) do
begin
if Stream.Read(Data179R, SizeOf(Data179R)) = 0 then //读到缓冲区内
begin
ClientSocket.Close;
Terminate;
end;
else
;//数据接收成功,执行动作
end;
finally
TheStream.Free;
end;
end;
使用上面的多线程的方法接收数据,然后将数据插入数据库中应该注意什么问题,是不是要创建多个Data module