Skip to content

Instantly share code, notes, and snippets.

@atomictom
Created March 25, 2014 04:16
Show Gist options
  • Save atomictom/9755185 to your computer and use it in GitHub Desktop.
Save atomictom/9755185 to your computer and use it in GitHub Desktop.
#!/usr/bin/python
#This file represents the simulation as it receives commands from the ANN and executes an action depending on the command.
import threading
import time
import zmq
def connection(socket):
while True:
socket.send('Simulation')
msg = socket.recv()
print msg
time.sleep(1)
def main():
context = zmq.Context()
socket = context.socket(zmq.REQ)
socket.bind('tcp://127.0.0.1:1234')
socket.connect('tcp://127.0.0.1:1235')
threading.Thread(target=connection, args=(socket,)).start()
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment