當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。