From 4b2096d2c697a7118490a5b5e5db7ac1a00124e1 Mon Sep 17 00:00:00 2001 From: William Falcon Date: Wed, 24 Jul 2019 14:52:19 -0400 Subject: [PATCH] added auto port find --- pytorch_lightning/utils/server.py | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 pytorch_lightning/utils/server.py diff --git a/pytorch_lightning/utils/server.py b/pytorch_lightning/utils/server.py new file mode 100644 index 00000000..455389d2 --- /dev/null +++ b/pytorch_lightning/utils/server.py @@ -0,0 +1,10 @@ +import socket + +s = socket.socket() +host = socket.gethostname() # Get local machine name +port = 12910 # Reserve a port for your service. +s.bind((host, port)) # Bind to the port + +s.listen(5) # Now wait for client connection. +while True: + c, addr = s.accept() # Establish connection with client. \ No newline at end of file