当前位置: 首页>>代码示例>>Python>>正文


Python _socket.socketpair方法代码示例

本文整理汇总了Python中_socket.socketpair方法的典型用法代码示例。如果您正苦于以下问题:Python _socket.socketpair方法的具体用法?Python _socket.socketpair怎么用?Python _socket.socketpair使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在_socket的用法示例。


在下文中一共展示了_socket.socketpair方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: socketpair

# 需要导入模块: import _socket [as 别名]
# 或者: from _socket import socketpair [as 别名]
def socketpair(family=None, type=SOCK_STREAM, proto=0):
        """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 the platform; otherwise, the default is AF_INET.
        """
        if family is None:
            try:
                family = AF_UNIX
            except NameError:
                family = AF_INET
        a, b = _socket.socketpair(family, type, proto)
        a = socket(family, type, proto, a.detach())
        b = socket(family, type, proto, b.detach())
        return a, b 
开发者ID:war-and-code,项目名称:jawfish,代码行数:19,代码来源:socket.py

示例2: socketpair

# 需要导入模块: import _socket [as 别名]
# 或者: from _socket import socketpair [as 别名]
def socketpair(family=None, type=SOCK_STREAM, proto=0):
        """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 the platform; otherwise, the default is AF_INET.

        .. versionchanged:: 1.2
           All Python 3 versions on Windows supply this function (natively
           supplied by Python 3.5 and above).
        """
        if family is None:
            try:
                family = AF_UNIX
            except NameError:
                family = AF_INET
        a, b = _socket.socketpair(family, type, proto)
        a = socket(family, type, proto, a.detach())
        b = socket(family, type, proto, b.detach())
        return a, b 
开发者ID:priyankark,项目名称:PhonePi_SampleServer,代码行数:23,代码来源:_socket3.py


注:本文中的_socket.socketpair方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。