59
59
from socket import error as socket_error
60
60
self._socket_error = socket_error
61
61
self._socket_timeout = socket_timeout
62
addrs = socket.getaddrinfo(host, port, socket.AF_UNSPEC,
65
(family, socktype, proto, canonname, sockaddr) = addrs
63
68
# SO_REUSERADDR has a different meaning on Windows
64
69
if sys.platform != 'win32':
65
70
self._server_socket.setsockopt(socket.SOL_SOCKET,
69
74
except self._socket_error, message:
70
75
raise errors.CannotBindAddress(host, port, message)
71
76
self._sockname = self._server_socket.getsockname()