本文整理汇总了Python中twisted.internet.tcp.Connector方法的典型用法代码示例。如果您正苦于以下问题:Python tcp.Connector方法的具体用法?Python tcp.Connector怎么用?Python tcp.Connector使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类twisted.internet.tcp
的用法示例。
在下文中一共展示了tcp.Connector方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: connectUNIX
# 需要导入模块: from twisted.internet import tcp [as 别名]
# 或者: from twisted.internet.tcp import Connector [as 别名]
def connectUNIX(self, address, factory, timeout=30, checkPID=0):
assert unixEnabled, "UNIX support is not present"
c = unix.Connector(address, factory, timeout, self, checkPID)
c.connect()
return c
示例2: connectTCP
# 需要导入模块: from twisted.internet import tcp [as 别名]
# 或者: from twisted.internet.tcp import Connector [as 别名]
def connectTCP(self, host, port, factory, timeout=30, bindAddress=None):
c = tcp.Connector(host, port, factory, timeout, bindAddress, self)
c.connect()
return c
# IReactorSSL (sometimes, not implemented)
示例3: connectSSL
# 需要导入模块: from twisted.internet import tcp [as 别名]
# 或者: from twisted.internet.tcp import Connector [as 别名]
def connectSSL(self, host, port, factory, contextFactory, timeout=30, bindAddress=None):
if tls is not None:
tlsFactory = tls.TLSMemoryBIOFactory(contextFactory, True, factory)
return self.connectTCP(host, port, tlsFactory, timeout, bindAddress)
elif ssl is not None:
c = ssl.Connector(
host, port, factory, contextFactory, timeout, bindAddress, self)
c.connect()
return c
else:
assert False, "SSL support is not present"
示例4: __init__
# 需要导入模块: from twisted.internet import tcp [as 别名]
# 或者: from twisted.internet.tcp import Connector [as 别名]
def __init__(self, host, port, factory, contextFactory, timeout, bindAddress, reactor=None):
self.contextFactory = contextFactory
tcp.Connector.__init__(self, host, port, factory, timeout, bindAddress, reactor)
# Force some parameter checking in pyOpenSSL. It's better to fail now
# than after we've set up the transport.
contextFactory.getContext()
示例5: test_tcp_repr
# 需要导入模块: from twisted.internet import tcp [as 别名]
# 或者: from twisted.internet.tcp import Connector [as 别名]
def test_tcp_repr(self):
c = Connector('localhost', 666, object(), 0, object())
expect = "<twisted.internet.tcp.Connector instance at 0x%x " \
"disconnected %s>"
expect = expect % (id(c), c.getDestination())
self.assertEqual(repr(c), expect)
示例6: connectUNIX
# 需要导入模块: from twisted.internet import tcp [as 别名]
# 或者: from twisted.internet.tcp import Connector [as 别名]
def connectUNIX(self, address, factory, timeout=30, checkPID=0):
"""@see: twisted.internet.interfaces.IReactorUNIX.connectUNIX
"""
assert unixEnabled, "UNIX support is not present"
c = unix.Connector(address, factory, timeout, self, checkPID)
c.connect()
return c
示例7: connectTCP
# 需要导入模块: from twisted.internet import tcp [as 别名]
# 或者: from twisted.internet.tcp import Connector [as 别名]
def connectTCP(self, host, port, factory, timeout=30, bindAddress=None):
"""@see: twisted.internet.interfaces.IReactorTCP.connectTCP
"""
c = tcp.Connector(host, port, factory, timeout, bindAddress, self)
c.connect()
return c
# IReactorSSL (sometimes, not implemented)
示例8: connectSSL
# 需要导入模块: from twisted.internet import tcp [as 别名]
# 或者: from twisted.internet.tcp import Connector [as 别名]
def connectSSL(self, host, port, factory, contextFactory, timeout=30, bindAddress=None):
"""@see: twisted.internet.interfaces.IReactorSSL.connectSSL
"""
assert sslEnabled, "SSL support is not present"
c = ssl.Connector(host, port, factory, contextFactory, timeout, bindAddress, self)
c.connect()
return c
示例9: __init__
# 需要导入模块: from twisted.internet import tcp [as 别名]
# 或者: from twisted.internet.tcp import Connector [as 别名]
def __init__(self, host, port, factory, timeout, bindAddress, reactor):
tcp.Connector.__init__(self, host, int(port), factory, timeout, bindAddress, reactor)