本文整理匯總了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
示例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
示例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
示例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
示例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
示例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
示例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)
示例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]
示例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)
示例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
示例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
示例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
示例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