BlinkenArea - GitList
Repositories
Blog
Wiki
stage_director
Code
Commits
Branches
Tags
Search
Tree:
1a73abb
Branches
Tags
master
stage_director
posy_packet.py
ignore I/O error on sync paket sending
Stefan Schuermans
commited
1a73abb
at 2018-09-30 16:49:54
posy_packet.py
Blame
History
Raw
#! /usr/bin/python3 import socket import struct import sys import time dest = ("127.0.0.1", 5740) name = "name_H23_X42" pos = 0.0 sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) sock.connect(dest) flags = 0 name_b = name.encode("utf-8") while True: pos_ms = round(pos * 1000) data = b"PoSy" + struct.pack("!I64sI", flags, name_b, pos_ms) try: sock.send(data) except IOError: pass pos += 1.0 time.sleep(1) sock.close()