comm_tcp: add connect timeout

This commit is contained in:
Sebastien Bourdeauducq 2015-08-28 16:23:23 +08:00
parent 241b7651a2
commit a36a50ba0d
1 changed files with 1 additions and 1 deletions

View File

@ -32,7 +32,7 @@ class Comm(CommGeneric):
def open(self): def open(self):
if hasattr(self, "socket"): if hasattr(self, "socket"):
return return
self.socket = socket.create_connection((self.host, self.port)) self.socket = socket.create_connection((self.host, self.port), 5.0)
set_keepalive(self.socket, 3, 2, 3) set_keepalive(self.socket, 3, 2, 3)
logger.debug("connected to host %s on port %d", self.host, self.port) logger.debug("connected to host %s on port %d", self.host, self.port)
self.write(b"ARTIQ coredev\n") self.write(b"ARTIQ coredev\n")