socketpair([family[, type[, proto]]]) -> (socket object, socket object) Create a pair of socket objects from the sockets returned by the platform socketpair() function. The arguments are the same as for socket() except the default family is AF_UNIX if defined on
(family=None, type=SOCK_STREAM, proto=0)
| 593 | if hasattr(_socket, "socketpair"): |
| 594 | |
| 595 | def socketpair(family=None, type=SOCK_STREAM, proto=0): |
| 596 | """socketpair([family[, type[, proto]]]) -> (socket object, socket object) |
| 597 | |
| 598 | Create a pair of socket objects from the sockets returned by the platform |
| 599 | socketpair() function. |
| 600 | The arguments are the same as for socket() except the default family is |
| 601 | AF_UNIX if defined on the platform; otherwise, the default is AF_INET. |
| 602 | """ |
| 603 | if family is None: |
| 604 | try: |
| 605 | family = AF_UNIX |
| 606 | except NameError: |
| 607 | family = AF_INET |
| 608 | a, b = _socket.socketpair(family, type, proto) |
| 609 | a = socket(family, type, proto, a.detach()) |
| 610 | b = socket(family, type, proto, b.detach()) |
| 611 | return a, b |
| 612 | |
| 613 | else: |
| 614 |
nothing calls this directly
no test coverage detected