handle socket error when closing
This commit is contained in:
parent
0758a79e64
commit
36bbb6690f
|
@ -242,7 +242,10 @@ class Network(Escpos):
|
||||||
def close(self):
|
def close(self):
|
||||||
""" Close TCP connection """
|
""" Close TCP connection """
|
||||||
if self.device is not None:
|
if self.device is not None:
|
||||||
self.device.shutdown(socket.SHUT_RDWR)
|
try:
|
||||||
|
self.device.shutdown(socket.SHUT_RDWR)
|
||||||
|
except socket.error:
|
||||||
|
pass
|
||||||
self.device.close()
|
self.device.close()
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue