Perform a bandwidth test. This is what I use (I bound the appropriate server and client codes). FWIW, I get a maximum of 500 Mbps, although I canβt process the data quickly.
procedure TForm1.IdTCPServer1Execute(AContext: TIdContext); var lData: TByteDynArray; lCaption: string; lMbps: Real; lLen: Integer; begin AContext.Connection.IoHandler.CheckForDataOnSource; SetLength(lData, 0); AContext.Connection.IoHandler.InputBuffer.ExtractToBytes(TIdBytes(lData), AContext.Connection.IoHandler.InputBuffer.Size); lLen := Length(lData); if lLen > 0 then begin if FStartTime = 0 then begin Memo1.Lines.Add(FormatDateTime('dd/mm/yyyy hh:nn:ss.zzz', CsiNow) +': Started test'); FStartTime := CsiNow; end; Inc(FBytesReceived, lLen); lCaption := 'MBits Received: ' + CsiPadFloat(FBytesReceived * 1.0 / 125000, 3, 1); if lCaption <> FLastCaption then begin Label1.Caption := lCaption; FLastCaption := lCaption; end; if FBytesReceived >= 12500000 then begin FStopTime := CsiNow; lMbps := 100000 / MilliSecondsBetween(FStopTime, FStartTime); Memo1.Lines.Add(FormatDateTime('dd/mm/yyyy hh:nn:ss.zzz', CsiNow) + ': Finished test (' + CsiPadFloat(lMbps, 3, 1) + ' Mbps)'); FBytesReceived := 0; FStartTime := 0; end end; CsiSleep(0); end; procedure TForm1.Button1Click(Sender: TObject); var lData: TByteDynArray; lIndex: Integer; begin IdTCPClient1.Host := Edit1.Text; IdTCPClient1.Connect; try SetLength(lData, 125000); for lIndex := 1 to 125000 do lData[lIndex - 1] := Ord('a'); for lIndex := 1 to 100 do IdTCPClient1.IoHandler.Write(TIdBytes(lData)); finally IdTCPClient1.Disconnect; end; end;
Misha source share