L
ludao
Unregistered / Unconfirmed
GUEST, unregistred user!
对方服务器(短连接模式,即:收到一个请求,处理后马上断开)!
故,我(客户端)采用多连接模式,即一个线程里建立一个连接.
请问,我在线程里建立的clientsocket是采用nonblocking模式,excute中采用代码:
while not Terminated do
begin
application.ProcessMessages;
end;
还是,采用blocking模式,excute中采用代码:
procedure TMyClientThread.Execute;
var
TheStream: TWinSocketStream;
buffer: string;
begin
{ create a TWinSocketStream for reading and writing }
TheStream := TWinSocketStream.Create(ClientSocket1.Socket, 60000);
try
while (not Terminated) and (ClientSocket1.Active) do
begin
..........
end;
finally
end;
end;
哪种效率更高?
故,我(客户端)采用多连接模式,即一个线程里建立一个连接.
请问,我在线程里建立的clientsocket是采用nonblocking模式,excute中采用代码:
while not Terminated do
begin
application.ProcessMessages;
end;
还是,采用blocking模式,excute中采用代码:
procedure TMyClientThread.Execute;
var
TheStream: TWinSocketStream;
buffer: string;
begin
{ create a TWinSocketStream for reading and writing }
TheStream := TWinSocketStream.Create(ClientSocket1.Socket, 60000);
try
while (not Terminated) and (ClientSocket1.Active) do
begin
..........
end;
finally
end;
end;
哪种效率更高?