Close I/O established in "open".
(self)
| 419 | |
| 420 | |
| 421 | def shutdown(self): |
| 422 | """Close I/O established in "open".""" |
| 423 | self._file.close() |
| 424 | try: |
| 425 | self.sock.shutdown(socket.SHUT_RDWR) |
| 426 | except OSError as exc: |
| 427 | # The server might already have closed the connection. |
| 428 | # On Windows, this may result in WSAEINVAL (error 10022): |
| 429 | # An invalid operation was attempted. |
| 430 | if (exc.errno != errno.ENOTCONN |
| 431 | and getattr(exc, 'winerror', 0) != 10022): |
| 432 | raise |
| 433 | finally: |
| 434 | self.sock.close() |
| 435 | |
| 436 | |
| 437 | def socket(self): |