Skip to content

Instantly share code, notes, and snippets.

@atomictom
Created March 25, 2014 04:16
Show Gist options
  • Save atomictom/9755188 to your computer and use it in GitHub Desktop.
Save atomictom/9755188 to your computer and use it in GitHub Desktop.
#!/usr/bin/python
# This file represents the ANN as it receives inputs from the simulation and does calculations depending on the input.
import threading
import time
import zmq
def connection(socket):
while True:
msg = socket.recv()
print msg
socket.send('ANN')
time.sleep(1)
def main():
context = zmq.Context()
socket = context.socket(zmq.REP)
socket.bind('tcp://127.0.0.1:1235')
socket.connect('tcp://127.0.0.1:1234')
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