mirror of
				https://github.com/python-escpos/python-escpos
				synced 2025-10-23 09:30:00 +00:00 
			
		
		
		
	handle socket error when closing
This commit is contained in:
		@@ -242,7 +242,10 @@ class Network(Escpos):
 | 
			
		||||
    def close(self):
 | 
			
		||||
        """ Close TCP connection """
 | 
			
		||||
        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()
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user