title: Send Files with TCP from client to server knowing file size Delphi
body: <p>Hello im trying to send a file Via TCP with delphi using Indy Components with a Client/Server</p>
  
  <p>i manage to send and recieve the files correctly, the problem is before sending the file i would like to send its size aswell to compare it after i get it the server.</p>
  
  <p>Now im sending the files from the Client To Server.</p>
  
  <p>Client:</p>
  
  <pre><code>Ms := TMemoryStream.Create;
    Ms.LoadFromFile('cliente.exe');
    Ms.Position := 0;
  
    Result := True;
    Client.IOHandler.LargeStream := True;
    try
      Client.IOHandler.Write(ms, 0, True);// (Ms, 0, true);
    except
      Result := False;
    end;
    Ms.Free;
  </code></pre>
  
  <p>Server:</p>
  
  <pre><code> AStream := TFileStream.Create('C:\temp\file.exe', fmCreate + fmShareDenyNone);
      try
        AContext.Connection.IOHandler.LargeStream := True;
        AContext.Connection.IOHandler.ReadStream(AStream, -1,false);
      finally
        FreeAndNil(AStream);
        Memo1.Lines.Add('File received');
      end;
  </code></pre>
  
  <p>So the question would be how could i send the file size with the file?</p>