當前位置: 首頁>>代碼示例>>Python>>正文


Python socket.__init__方法代碼示例

本文整理匯總了Python中socket.socket.__init__方法的典型用法代碼示例。如果您正苦於以下問題:Python socket.__init__方法的具體用法?Python socket.__init__怎麽用?Python socket.__init__使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在socket.socket的用法示例。


在下文中一共展示了socket.__init__方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: __init__

# 需要導入模塊: from socket import socket [as 別名]
# 或者: from socket.socket import __init__ [as 別名]
def __init__(self, sock, keyfile=None, certfile=None,
                 server_side=False, cert_reqs=CERT_NONE,
                 ssl_version=PROTOCOL_SSLv23, ca_certs=None,
                 do_handshake_on_connect=True,
                 suppress_ragged_eofs=True, ciphers=None):
        socket.__init__(self, _sock=sock._sock)
        # The initializer for socket overrides the methods send(), recv(), etc.
        # in the instancce, which we don't need -- but we want to provide the
        # methods defined in SSLSocket.
        for attr in _delegate_methods:
            try:
                delattr(self, attr)
            except AttributeError:
                pass

        if certfile and not keyfile:
            keyfile = certfile
        # see if it's connected
        try:
            socket.getpeername(self)
        except socket_error, e:
            if e.errno != errno.ENOTCONN:
                raise
            # no, no connection yet
            self._connected = False
            self._sslobj = None 
開發者ID:glmcdona,項目名稱:meddle,代碼行數:28,代碼來源:ssl.py

示例2: __init__

# 需要導入模塊: from socket import socket [as 別名]
# 或者: from socket.socket import __init__ [as 別名]
def __init__(self, protocol):
        self.protocol = protocol 
開發者ID:IronLanguages,項目名稱:ironpython2,代碼行數:4,代碼來源:ssl.py

示例3: __init__

# 需要導入模塊: from socket import socket [as 別名]
# 或者: from socket.socket import __init__ [as 別名]
def __init__(self, sock, keyfile=None, certfile=None,
                 server_side=False, cert_reqs=CERT_NONE,
                 ssl_version=PROTOCOL_SSLv23, ca_certs=None,
                 do_handshake_on_connect=True,
                 suppress_ragged_eofs=True, ciphers=None):
        socket.__init__(self, _sock=sock._sock)
        # The initializer for socket overrides the methods send(), recv(), etc.
        # in the instancce, which we don't need -- but we want to provide the
        # methods defined in SSLSocket.
        for attr in _delegate_methods:
            try:
                delattr(self, attr)
            except AttributeError:
                pass

        if ciphers is None and ssl_version != _SSLv2_IF_EXISTS:
            ciphers = _DEFAULT_CIPHERS

        if certfile and not keyfile:
            keyfile = certfile
        # see if it's connected
        try:
            socket.getpeername(self)
        except socket_error, e:
            if e.errno != errno.ENOTCONN:
                raise
            # no, no connection yet
            self._connected = False
            self._sslobj = None 
開發者ID:dxwu,項目名稱:BinderFilter,代碼行數:31,代碼來源:ssl.py

示例4: __init__

# 需要導入模塊: from socket import socket [as 別名]
# 或者: from socket.socket import __init__ [as 別名]
def __init__(self, protocol=PROTOCOL_TLS):
        self.protocol = protocol 
開發者ID:ShikyoKira,項目名稱:Project-New-Reign---Nemesis-Main,代碼行數:4,代碼來源:ssl.py


注:本文中的socket.socket.__init__方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。