Return a connection object connected to the pipe given by `address`
(address)
| 710 | _winapi.CloseHandle(handle) |
| 711 | |
| 712 | def PipeClient(address): |
| 713 | ''' |
| 714 | Return a connection object connected to the pipe given by `address` |
| 715 | ''' |
| 716 | t = _init_timeout() |
| 717 | while 1: |
| 718 | try: |
| 719 | _winapi.WaitNamedPipe(address, 1000) |
| 720 | h = _winapi.CreateFile( |
| 721 | address, _winapi.GENERIC_READ | _winapi.GENERIC_WRITE, |
| 722 | 0, _winapi.NULL, _winapi.OPEN_EXISTING, |
| 723 | _winapi.FILE_FLAG_OVERLAPPED, _winapi.NULL |
| 724 | ) |
| 725 | except OSError as e: |
| 726 | if e.winerror not in (_winapi.ERROR_SEM_TIMEOUT, |
| 727 | _winapi.ERROR_PIPE_BUSY) or _check_timeout(t): |
| 728 | raise |
| 729 | else: |
| 730 | break |
| 731 | else: |
| 732 | raise |
| 733 | |
| 734 | _winapi.SetNamedPipeHandleState( |
| 735 | h, _winapi.PIPE_READMODE_MESSAGE, None, None |
| 736 | ) |
| 737 | return PipeConnection(h) |
| 738 | |
| 739 | # |
| 740 | # Authentication stuff |
no test coverage detected