Shell output not returned until process ends (iperf3)

Hi all,

I’m writing a GUI for iperf3, which works very nicely under macOS. However, under Windows, if I use a Shell in mode 2, iperf3 runs, but the result is not returned at 1-second intervals so I can update gauges/graphs in the GUI, but is returned all in one single block after the iperf3 test ends:

[code][ 4] local port 60415 connected to x.x.x.x port 5201
[ ID] Interval Transfer Bandwidth
[ 4] 0.00-1.00 sec 1.67 MBytes 14039 Kbits/sec
[ 4] 1.00-2.00 sec 2.64 MBytes 22157 Kbits/sec
[ 4] 2.00-3.00 sec 2.64 MBytes 22115 Kbits/sec
[ 4] 3.00-4.00 sec 2.64 MBytes 22209 Kbits/sec
[ 4] 4.00-5.00 sec 2.56 MBytes 21483 Kbits/sec

[ ID] Interval Transfer Bandwidth
[ 4] 0.00-5.00 sec 12.2 MBytes 20400 Kbits/sec sender
[ 4] 0.00-5.00 sec 12.1 MBytes 20337 Kbits/sec receiver

iperf Done.

The “Interval” lines come in every second if the command is run in a normal cmd.exe window, but no matter what I try I cannot get the same result when running from Xojo.

I’m using the same code as in the Async Shell example provided with Xojo, and the result is the same if run in the example.

Any ideas?

@Mike Puchol — Instead of relying on Shell.DataAvailable, you may want to set a Timer which polls the Shell every second

when you run it in a terminal hows the output (I dont have it here so …)
it it perhaps using terminal control sequences to overwrite existing lines with new data ?
is there a way to force it to NOT do that so you literally get one line after the other ?

Thanks for suggestion & comments - I have modified the code to use the DataAvailable Shell event, combined with a timer that runs Poll every 250ms. This works perfectly fine if I run ping x.x.x.x, I get one line per second with ping result.

Running iperf3 results in the same problem, it’s as if iperf3 doesn’t flush the output buffer (I may have got terminology completely wrong here!) after each line is output.

So I have finally fixed it, but by updating to a recent iperf3 version, which includes a new option (–forceflush) which flushes stdout after each test result line is written. Works perfectly now.