在delphi的 Writing client threads 例子中,GetNextRequest(buffer)是什么意思?(20分)

  • 主题发起人 主题发起人 zrx_jyp
  • 开始时间 开始时间
Z

zrx_jyp

Unregistered / Unconfirmed
GUEST, unregistred user!
在delphi的 Writing client threads 例子中:

procedure TMyClientThread.Execute;
var
TheStream: TWinSocketStream;
buffer: string;
begin
{ create a TWinSocketStream for reading and writing }
TheStream := TWinSocketStream.Create(ClientSocket1.Socket, 60000);
try
{ fetch and process commands until the connection or thread is terminated }
while (not Terminated) and (ClientSocket1.Active) do
begin
try
GetNextRequest(buffer); { GetNextRequest must be a thread-safe method }

{ write the request to the server }
TheStream.Write(buffer, Length(buffer) + 1);
{ continue the communication (e.g. read a response from the server) }
...
except
if not(ExceptObject is EAbort) then
Synchronize(HandleThreadException); { you must write HandleThreadException }
end;
end;
finally
TheStream.free;
end;
end;

// GetNextRequest(buffer); { GetNextRequest must be a thread-safe method } 是什么意思?


 
后退
顶部