Stream : TWinSocketStream;
buffer1: array[0 .. 1023] of Char;
Stream := TWinSocketStream.Create(ClientSocket, 30000);
FillChar(Buffer1, 1024, 0);
if Stream.WaitForData(20000) then //等待数据到来
begin
if Stream.Read(Buffer1, 1024) = 0 then //读数据
ClientSocket.Close
else
begin
//处理受到的数据
Stream.Free;
ClientSocket.Close;
end;
end
else
ClientSocket.Close;
end;
except
//HandleException;
end;