This is the area on a PR1 to enable the streaming:
Set index 4 to 1 to enable, 0 to disable the stream.
Index 5 is the interval in milliseconds.
Index 6 is the UDP port to stream to
Index 8 is the IP address of the system you are streaming to, each octet of the IP uses a byte of the value.
Default is to stream every IO channel possible, which is 2,308 bytes on the PR1 - this can be optimized by setting up the custom configuration area for the addresses you need and setting the streaming configuration to use the custom configuration area (check the OptoMMP Protocol Guide).
When streaming all 2,308 bytes and setting the index 5 to 1 for 1 ms, I was averaging a little over 2 ms for each push.
Note for Opto22 Devs: If I have the streaming set to 1 or 2 ms and then set index 4 to 0 to stop streaming, the streaming doesn’t stop - I think there is a bug here. I have to set the interval to 3ms or higher first, then I can write a 0 to index 4 and it stops.
Ugly Python UDP listener code that times the intervals and averages the last 100 and displays the results repeatedly:
from timeit import default_timer as timer
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
lstTimes = [0.0]*100
start = 0
data, sender = sock.recvfrom(2500)
end = timer()
duration = end-start
start = timer()
i = i + 1
if i == 100:
i = 0
size = len(data)
avg = sum(lstTimes)/100.0
print("Received a message of size %d bytes. Time since last packet: %6.4f. Average: %6.4f" % (size, duration, avg), end='\r')