title: Indy TIdTcpServer input buffer empty
body: <p>I have an application that listens for a tcp client connection. When the client connects, the client sends over a large chunk of data, in one example 100+k. The Indy TCPServer receives it, processes/reformats the data, sends it on to an http server in the cloud, receives a response, creates an acknowledgement based on the response, and sends it back to the client, disconnecting the connection.</p>
  <pre><code>procedure TMyApp.TCPConnect(AContext: TIdContext);
  begin
    try
      AContext.Connection.Socket.ReadTimeout := 10000;
    except
      on E:Exception do
        AContext.Connection.Disconnect;
    end;
  end;
  
  procedure TMyApp.TCPDisconnect(AContext: TIdContext);
  begin
    SetLength(FMDMStr,0);
  end;
  
  function TMyApp.TransferTCPBytesToString(AnIOHandler: TIdIOHandler): String;
  begin
    if AnIOHandler.InputBufferIsEmpty then
      Exit;
    Result := AnIOHandler.WaitFor(#28#13,True,True);
    if Pos(#28#13,Result) = 0 then
      Result := Result + #28#13;
  end;
  
  procedure TMyApp.WriteTCPResponse(AnIOHandler: TIdIOHandler);
  var
    bytes: TIdBytes;
  begin
    BuildACK(FMDMStr,bytes);
    AnIOHandler.WriteDirect(bytes, Length(bytes));
  end;
  
  procedure TMyApp.TCPExecute(AContext: TIdContext);
  begin
    try
      FMDMStr := TransferTCPBytesToString(AContext.Connection.IOHandler);
      // test string for HL/7 terminating characters
      if Pos(#28#13, FMDMStr) &gt; 0 then
      begin
        FormatAndSendHTTPMsg(FMDMStr);
        // send the response back to tcp client
        WriteTCPResponse(AContext.Connection.IOHandler);
      end;
    except
      on E:Exception do
        AContext.Connection.Disconnect;
    end;
  end;
  </code></pre>
  <p>I have used this app in varying scenarios for over 2 years and it works well. I've tested it across multiple windows 10 &amp; windows server 2016 SE servers and it works fine.</p>
  <p>The most recent deployment isn't working at all; the same client sends across &gt;100k of data, connecting to the TIdTcpServer; the execute method fires, but there is a -0- sized input buffer. I've set the receive buffer to 256k just to be on the safe side. Here's what I'm logging:</p>
  <pre><code>AContext.Connection.IOHandler.InputBufferAsString
  AContext.Connection.IOHandler.RecvBufferSize
  AContext.Connection.IOHandler.InputBufferIsEmpty
  </code></pre>
  <p>ReceiveBuffer logs as 262144. InputBufferIsEmpty always comes back true! And of course the InputBufferAsString := ''.</p>
  <p>So I'm wondering if this could possibly be a security &quot;feature&quot; on the server/network/domain that the app is running on? I've tested it on two different servers on the domain, exactly the same result. Client connects, logs that it is sending, the IdTcpServer logs the connection, but receives nothing.</p>
  <p>Any thoughts or advice will be greatly appreciated! TIA</p>