Skip to content

Instantly share code, notes, and snippets.

@sphaero
Created March 31, 2014 15:28
Show Gist options
  • Save sphaero/9894925 to your computer and use it in GitHub Desktop.
Save sphaero/9894925 to your computer and use it in GitHub Desktop.
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