Replace addrinfo with socket() static method.

WebSocketServer.socket() is a static method takes a host and port and
an optional connect parameter. If connect is not set then it returns
a socket listening on host and port. If connect is set then
a connection will be made host and port and the socket returned. This
has IPv6 support like the addrinfo method it replaces.

Also, prefer IPv4 resolutions if they are in the list. This can be
overriden to prefer IPv6 resolutions for the same host using the
optional prefer_ipv6 parameter.
This commit is contained in:
Joel Martin
2011-07-09 13:34:53 -05:00
parent 7ae8711dc6
commit 46e2fbee5f
2 changed files with 27 additions and 15 deletions
+2 -3
View File
@@ -141,9 +141,8 @@ Traffic Legend:
# Connect to the target
self.msg("connecting to: %s:%s" % (
self.target_host, self.target_port))
addr = self.addrinfo(self.target_host, self.target_port)
tsock = socket.socket(addr[0], addr[1])
tsock.connect((self.target_host, self.target_port))
tsock = self.socket(self.target_host, self.target_port,
connect=True)
if self.verbose and not self.daemon:
print(self.traffic_legend)