anchor.diff:  
   function TTcpSocketStreamImpl.WaitForData( TimeOut : Integer; pBuf : Pointer;
                                              DesiredBytes : Integer;
  -                                           var wsaError : Integer): TWaitForData;
  +                                           var wsaError, bytesReady : Integer): TWaitForData;
   var bCanRead, bError : Boolean;
       retval : Integer;
   begin
  +  bytesReady := 0;
  +
     // The select function returns the total number of socket handles that are ready
     // and contained in the fd_set structures, zero if the time limit expired,
     // or SOCKET_ERROR if an error occurred. If the return value is SOCKET_ERROR,
  
positive.code:   if retval <= 0
    then Exit( TWaitForData.wfd_Error);
  
    // Enough data ready to be read?
    if retval = DesiredBytes
    then result := TWaitForData.wfd_HaveData
    else result := TWaitForData.wfd_Timeout;
  end;
  
  function TTcpSocketStreamImpl.Read(var buffer: TBytes; offset, count: Integer): Integer;
  var wfd : TWaitForData;
      wsaError : Integer;
      pDest : Pointer;
  const
    SLEEP_TIME = 200;
  begin
    inherited;
  
    pDest := Pointer(@buffer[offset]);
  
    while TRUE do begin
      if FTimeout > 0
      then wfd := WaitForData( FTimeout,   pDest, count, wsaError)
      else wfd := WaitForData( SLEEP_TIME, pDest, count, wsaError);
  
      case wfd of
        TWaitForData.wfd_Error    :  Exit(0);
        TWaitForData.wfd_HaveData :  Break;
        TWaitForData.wfd_Timeout  :  begin
          if (FTimeout > 0)
          then raise TTransportException.Create( TTransportException.TExceptionType.TimedOut,
                                                 SysErrorMessage(Cardinal(wsaError)));
        end;
      else
        ASSERT( FALSE);
      end;
    end;
  
    Result := FTcpClient.ReceiveBuf( pDest^, count);
  end;
  
  function TTcpSocketStreamImpl.ToArray: TBytes;
  
negative.code:     function Select( ReadReady, WriteReady, ExceptFlag: PBoolean;
                       TimeOut: Integer; var wsaError : Integer): Integer;
      function WaitForData( TimeOut : Integer; pBuf : Pointer; DesiredBytes: Integer;
                            var wsaError, bytesReady : Integer): TWaitForData;
    protected
      procedure Write( const buffer: TBytes; offset: Integer; count: Integer); override;
      function Read( var buffer: TBytes; offset: Integer; count: Integer): Integer; override;
  