Created
March 25, 2014 04:16
-
-
Save atomictom/9755185 to your computer and use it in GitHub Desktop.
This file contains 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
#!/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