def subEndpoint(self, reactor, host, port, contextFactory):
"""
Create an endpoint to connect to based on a single address result from
L{getaddrinfo}.
@param reactor: the reactor to connect to
@type reactor: L{IReactorTCP}
@param host: The IP address of the host to connect to, in presentation
format.
@type host: L{str}
@param port: The numeric port number to connect to.
@type port: L{int}
@param contextFactory: If not L{None}, the OpenSSL context factory to
use to produce client connections.
@return: a stream client endpoint that will connect to the given host
and port via the given reactor.
@rtype: L{IStreamClientEndpoint}
"""
if contextFactory is None:
return TCP4ClientEndpoint(reactor, host, port)
else:
return SSL4ClientEndpoint(reactor, host, port, contextFactory)
评论列表
文章目录