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


Python ssl.Port方法代碼示例

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


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

示例1: adoptStreamPort

# 需要導入模塊: from twisted.internet import ssl [as 別名]
# 或者: from twisted.internet.ssl import Port [as 別名]
def adoptStreamPort(self, fileDescriptor, addressFamily, factory):
        """
        Create a new L{IListeningPort} from an already-initialized socket.

        This just dispatches to a suitable port implementation (eg from
        L{IReactorTCP}, etc) based on the specified C{addressFamily}.

        @see: L{twisted.internet.interfaces.IReactorSocket.adoptStreamPort}
        """
        if addressFamily not in (socket.AF_INET, socket.AF_INET6):
            raise error.UnsupportedAddressFamily(addressFamily)

        p = tcp.Port._fromListeningDescriptor(
            self, fileDescriptor, addressFamily, factory)
        p.startListening()
        return p 
開發者ID:proxysh,項目名稱:Safejumper-for-Desktop,代碼行數:18,代碼來源:posixbase.py

示例2: adoptStreamPort

# 需要導入模塊: from twisted.internet import ssl [as 別名]
# 或者: from twisted.internet.ssl import Port [as 別名]
def adoptStreamPort(self, fileDescriptor, addressFamily, factory):
        """
        Create a new L{IListeningPort} from an already-initialized socket.

        This just dispatches to a suitable port implementation (eg from
        L{IReactorTCP}, etc) based on the specified C{addressFamily}.

        @see: L{twisted.internet.interfaces.IReactorSocket.adoptStreamPort}
        """
        if addressFamily not in self._supportedAddressFamilies:
            raise error.UnsupportedAddressFamily(addressFamily)

        if unixEnabled and addressFamily == socket.AF_UNIX:
            p = unix.Port._fromListeningDescriptor(
                self, fileDescriptor, factory)
        else:
            p = tcp.Port._fromListeningDescriptor(
                self, fileDescriptor, addressFamily, factory)
        p.startListening()
        return p 
開發者ID:wistbean,項目名稱:learn_python3_spider,代碼行數:22,代碼來源:posixbase.py

示例3: listenUDP

# 需要導入模塊: from twisted.internet import ssl [as 別名]
# 或者: from twisted.internet.ssl import Port [as 別名]
def listenUDP(self, port, protocol, interface='', maxPacketSize=8192):
        """Connects a given L{DatagramProtocol} to the given numeric UDP port.

        @returns: object conforming to L{IListeningPort}.
        """
        p = udp.Port(port, protocol, interface, maxPacketSize, self)
        p.startListening()
        return p

    # IReactorMulticast 
開發者ID:proxysh,項目名稱:Safejumper-for-Desktop,代碼行數:12,代碼來源:posixbase.py

示例4: listenUNIX

# 需要導入模塊: from twisted.internet import ssl [as 別名]
# 或者: from twisted.internet.ssl import Port [as 別名]
def listenUNIX(self, address, factory, backlog=50, mode=0o666, wantPID=0):
        assert unixEnabled, "UNIX support is not present"
        p = unix.Port(address, factory, backlog, mode, self, wantPID)
        p.startListening()
        return p


    # IReactorUNIXDatagram 
開發者ID:proxysh,項目名稱:Safejumper-for-Desktop,代碼行數:10,代碼來源:posixbase.py

示例5: adoptDatagramPort

# 需要導入模塊: from twisted.internet import ssl [as 別名]
# 或者: from twisted.internet.ssl import Port [as 別名]
def adoptDatagramPort(self, fileDescriptor, addressFamily, protocol,
                          maxPacketSize=8192):
        if addressFamily not in (socket.AF_INET, socket.AF_INET6):
            raise error.UnsupportedAddressFamily(addressFamily)

        p = udp.Port._fromListeningDescriptor(
            self, fileDescriptor, addressFamily, protocol,
            maxPacketSize=maxPacketSize)
        p.startListening()
        return p



    # IReactorTCP 
開發者ID:proxysh,項目名稱:Safejumper-for-Desktop,代碼行數:16,代碼來源:posixbase.py

示例6: listenTCP

# 需要導入模塊: from twisted.internet import ssl [as 別名]
# 或者: from twisted.internet.ssl import Port [as 別名]
def listenTCP(self, port, factory, backlog=50, interface=''):
        p = tcp.Port(port, factory, backlog, interface, self)
        p.startListening()
        return p 
開發者ID:proxysh,項目名稱:Safejumper-for-Desktop,代碼行數:6,代碼來源:posixbase.py

示例7: doRead

# 需要導入模塊: from twisted.internet import ssl [as 別名]
# 或者: from twisted.internet.ssl import Port [as 別名]
def doRead(self):
        self.numberAccepts = min(
            self.factory.maxRequests - self.factory.outstandingRequests,
            self.factory.maxAccepts
        )
        tcp.Port.doRead(self) 
開發者ID:apple,項目名稱:ccs-twistedextensions,代碼行數:8,代碼來源:tcp.py

示例8: __init__

# 需要導入模塊: from twisted.internet import ssl [as 別名]
# 或者: from twisted.internet.ssl import Port [as 別名]
def __init__(self, fd, factory, reactor):
        tcp.Port.__init__(self, 0, factory, reactor=reactor)
        # MOR: careful because fromfd dup()'s the socket, so we need to
        # make sure we don't leak file descriptors
        self.socket = socket.fromfd(fd, socket.AF_INET, socket.SOCK_STREAM)
        self._realPortNumber = self.port = self.socket.getsockname()[1] 
開發者ID:apple,項目名稱:ccs-twistedextensions,代碼行數:8,代碼來源:tcp.py

示例9: _preMakeConnection

# 需要導入模塊: from twisted.internet import ssl [as 別名]
# 或者: from twisted.internet.ssl import Port [as 別名]
def _preMakeConnection(self, transport):
        transport._startTLS()
        return tcp.Port._preMakeConnection(self, transport) 
開發者ID:apple,項目名稱:ccs-twistedextensions,代碼行數:5,代碼來源:tcp.py

示例10: listenTCP

# 需要導入模塊: from twisted.internet import ssl [as 別名]
# 或者: from twisted.internet.ssl import Port [as 別名]
def listenTCP(self, port, factory, backlog=50, interface=''):
        """@see: twisted.internet.interfaces.IReactorTCP.listenTCP
        """
        p = tcp.Port(port, factory, backlog, interface, self)
        p.startListening()
        return p 
開發者ID:kuri65536,項目名稱:python-for-android,代碼行數:8,代碼來源:posixbase.py

示例11: listenSSL

# 需要導入模塊: from twisted.internet import ssl [as 別名]
# 或者: from twisted.internet.ssl import Port [as 別名]
def listenSSL(self, port, factory, contextFactory, backlog=50, interface=''):
        """@see: twisted.internet.interfaces.IReactorSSL.listenSSL
        """
        assert sslEnabled, "SSL support is not present"
        p = ssl.Port(port, factory, contextFactory, backlog, interface, self)
        p.startListening()
        return p


    # IReactorArbitrary 
開發者ID:kuri65536,項目名稱:python-for-android,代碼行數:12,代碼來源:posixbase.py

示例12: listenUDP

# 需要導入模塊: from twisted.internet import ssl [as 別名]
# 或者: from twisted.internet.ssl import Port [as 別名]
def listenUDP(self, port, protocol, interface='', maxPacketSize=8192):
        """Connects a given L{DatagramProtocol} to the given numeric UDP port.

        @returns: object conforming to L{IListeningPort}.
        """
        p = udp.Port(port, protocol, interface, maxPacketSize, self)
        p.startListening()
        return p 
開發者ID:kenorb-contrib,項目名稱:BitTorrent,代碼行數:10,代碼來源:posixbase.py

示例13: listenSSL

# 需要導入模塊: from twisted.internet import ssl [as 別名]
# 或者: from twisted.internet.ssl import Port [as 別名]
def listenSSL(self, port, factory, contextFactory, backlog=50, interface=''):
        """@see: twisted.internet.interfaces.IReactorSSL.listenSSL
        """
        assert sslEnabled, "SSL support is not present"
        p = ssl.Port(port, factory, contextFactory, backlog, interface, self)
        p.startListening()
        return p

    # IReactorArbitrary 
開發者ID:kenorb-contrib,項目名稱:BitTorrent,代碼行數:11,代碼來源:posixbase.py


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