本文整理汇总了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