Skip to content

Commit

Permalink
send frame-at-a-time to aid synchronisation
Browse files Browse the repository at this point in the history
  • Loading branch information
ZXGuesser committed Jun 29, 2024
1 parent 55a2c38 commit 2168dfd
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packet-server.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,15 @@ def server6(PORT):
data = bytearray(inputfile.buffer.read(42 * linesPerField))
if not data:
inputfile.seek(0) # loop input file
continue
if (linesPerField < 16):
data.extend(bytearray(42*(16-linesPerField)))
data.extend(bytearray(inputfile.buffer.read(42 * linesPerField)))
if (linesPerField < 16):
data.extend(bytearray(42*(16-linesPerField)))
for q in clientQueues[:]:
if q.qsize() > 4: # allow 4 fields of buffering
with q.mutex:
q.queue.clear()
q.put(data)
time.sleep(0.02 - ((time.time() - starttime) % 0.02))
time.sleep(0.04 - ((time.time() - starttime) % 0.04))

0 comments on commit 2168dfd

Please sign in to comment.