Returns a connection to the address of a `Listener`
(address, family=None, authkey=None)
| 508 | |
| 509 | |
| 510 | def Client(address, family=None, authkey=None): |
| 511 | ''' |
| 512 | Returns a connection to the address of a `Listener` |
| 513 | ''' |
| 514 | family = family or address_type(address) |
| 515 | _validate_family(family) |
| 516 | if family == 'AF_PIPE': |
| 517 | c = PipeClient(address) |
| 518 | else: |
| 519 | c = SocketClient(address) |
| 520 | |
| 521 | if authkey is not None and not isinstance(authkey, bytes): |
| 522 | raise TypeError('authkey should be a byte string') |
| 523 | |
| 524 | if authkey is not None: |
| 525 | answer_challenge(c, authkey) |
| 526 | deliver_challenge(c, authkey) |
| 527 | |
| 528 | return c |
| 529 | |
| 530 | |
| 531 | if sys.platform != 'win32': |
no test coverage detected