也许对你有所帮助:
wssRecvStream : TWinSocketStream;
clientSocket1 : TClientSocket;
wssRecvStream := TWinSocketStream.Create(clientSocket1.Socket,receiveTimeOut);
var
Buffer : Array[0..2047] of Char;
recvNum : Integer;
begin
if clientSocket1.Socket.Connected and wssRecvStream.WaitForData(receiveTimeOut) then
begin
FillChar(Buffer,SizeOf(Buffer),0);
recvNum := wssRecvStream.Read(Buffer, SizeOf(Buffer));
recevedBytes := recvNum;
end;
end;