summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLance Stout <lancestout@gmail.com>2012-05-06 12:17:50 -0700
committerLance Stout <lancestout@gmail.com>2012-05-06 12:17:50 -0700
commit03dedfc871394a246d48b78ed9cf322218ab5168 (patch)
treed07e8563af370f5d72b57c222dba0366fa54169b
parent9e86a7b357afffdf5cb99cf4de76472f29f740e4 (diff)
downloadslixmpp-03dedfc871394a246d48b78ed9cf322218ab5168.tar.gz
slixmpp-03dedfc871394a246d48b78ed9cf322218ab5168.tar.bz2
slixmpp-03dedfc871394a246d48b78ed9cf322218ab5168.tar.xz
slixmpp-03dedfc871394a246d48b78ed9cf322218ab5168.zip
Windows doesn't support inet_pton.
-rw-r--r--sleekxmpp/xmlstream/resolver.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/sleekxmpp/xmlstream/resolver.py b/sleekxmpp/xmlstream/resolver.py
index 3c3896a3..7ca90bfa 100644
--- a/sleekxmpp/xmlstream/resolver.py
+++ b/sleekxmpp/xmlstream/resolver.py
@@ -93,15 +93,16 @@ def resolve(host, port=None, service=None, proto='tcp', resolver=None):
try:
# If `host` is an IPv4 literal, we can return it immediately.
- ipv4 = socket.inet_pton(socket.AF_INET, host)
+ ipv4 = socket.inet_aton(host)
yield (host, port)
except socket.error:
pass
try:
# Likewise, If `host` is an IPv6 literal, we can return it immediately.
- ipv6 = socket.inet_pton(socket.AF_INET6, host)
- yield (host, port)
+ if hasattr(socket, 'inet_pton'):
+ ipv6 = socket.inet_pton(socket.AF_INET6, host)
+ yield (host, port)
except socket.error:
pass