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