Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions holideck.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,17 @@
from multiprocessing import Process, Queue
import iotas.iotas
import simpype.simpype
import socket

def probe(port):
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
res = sock.connect_ex(('127.0.0.1', port))
if res != 0:
return port
else:
sock.close()
print >> sys.stderr, "Dodging conflict on TCP port %d." % port
return probe(port + 1)

if __name__ == '__main__':

Expand All @@ -38,6 +49,9 @@
spp_port = 8888 # If any error use default values
iop_port = 8080

spp_port = probe(spp_port)
iop_port = probe(iop_port)

# Create a Queue instance so the processes can share the datas
q = Queue()

Expand Down