Commit 22eb0baa authored by Guillaume Seguin's avatar Guillaume Seguin

Fix disconnect action for TCP connections

parent a5c5a924
......@@ -123,8 +123,10 @@ class printcore():
if not is_serial:
self.printer_tcp = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self.timeout = 0.25
self.printer_tcp.settimeout(1.0)
try:
self.printer_tcp.connect((hostname, port))
self.printer_tcp.settimeout(self.timeout)
self.printer = self.printer_tcp.makefile()
except socket.error:
print _("Could not connect to %s:%s:") % (hostname, port)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment