A Visual Studio program connecting over Ethernet will not be deterministic. So there will be timing errors.
The built-in SCOPE command can be used to log data. It will save data to TABLE at the servo cycle rate. So if SERVO_PERIOD is 1000 usec, then to save values at 0.05 second intervals use this command:
'SCOPE(enable, period, table_start, table_stop, p0 [,p1..... )
SCOPE(ON, 50, 1000, 1099, AIN0) ' this will log 100 values from analgue input 0 at 50 msec intervals.
TRIGGER ' start the recording
WAIT UNTIL SCOPE_POS = 1099
now the data is ready to uploaded from TABLE(1000) to TABLE(1099)