Advertisement
Guest User

Untitled

a guest
May 26th, 2015
190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. import zmq
  2. import random
  3.  
  4. context = zmq.Context()
  5. socket = context.socket(zmq.PUB)
  6. socket.bind("tcp://*:5555")
  7.  
  8. while True:
  9. zipcode = random.randrange(1, 100000)
  10. temperature = random.randrange(1, 215) - 80
  11. relhumidity = random.randrange(1, 50) + 10
  12.  
  13. socket.send("%d %d %d" % (zipcode, temperature, relhumidity))
  14. print (zipcode, temperature, relhumidity)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement