Created
March 31, 2014 15:28
-
-
Save sphaero/9894925 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pyre import zbeacon | |
import zmq | |
import struct | |
import uuid | |
import socket | |
ctx = zmq.Context() | |
beacon = zbeacon.ZBeacon(ctx, 1200) | |
transmit = struct.pack('cccb16sH', b'Z',b'R',b'E', | |
1, uuid.uuid4().bytes, | |
socket.htons(1300)) | |
beacon.publish(transmit) | |
beacon_pipe = beacon.get_socket() | |
while True: | |
try: | |
msg = beacon_pipe.recv() | |
print("BEACONMSG: %s" %msg) | |
except (KeyboardInterrupt, SystemExit): | |
break | |
del(beacon) | |
print("FINISHED") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment