Stefan Schuermans commited on 2018-09-30 16:32:04
Showing 1 changed files, with 24 additions and 0 deletions.
| ... | ... |
@@ -0,0 +1,24 @@ |
| 1 |
+#! /usr/bin/python3 |
|
| 2 |
+ |
|
| 3 |
+import socket |
|
| 4 |
+import struct |
|
| 5 |
+import sys |
|
| 6 |
+import time |
|
| 7 |
+ |
|
| 8 |
+dest = ("127.0.0.1", 5740)
|
|
| 9 |
+name = "name_H23_X42" |
|
| 10 |
+pos = 0.0 |
|
| 11 |
+ |
|
| 12 |
+sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) |
|
| 13 |
+sock.connect(dest) |
|
| 14 |
+ |
|
| 15 |
+flags = 0 |
|
| 16 |
+name_b = name.encode("utf-8")
|
|
| 17 |
+while True: |
|
| 18 |
+ pos_ms = round(pos * 1000) |
|
| 19 |
+ data = b"PoSy" + struct.pack("!I64sI", flags, name_b, pos_ms)
|
|
| 20 |
+ sock.send(data) |
|
| 21 |
+ pos += 1.0 |
|
| 22 |
+ time.sleep(1) |
|
| 23 |
+sock.close() |
|
| 24 |
+ |
|
| 0 | 25 |