equal
deleted
inserted
replaced
258 try: |
258 try: |
259 with contextlib.closing(socket.socket(family, socket.SOCK_STREAM)) as s: |
259 with contextlib.closing(socket.socket(family, socket.SOCK_STREAM)) as s: |
260 s.bind(('localhost', port)) |
260 s.bind(('localhost', port)) |
261 return True |
261 return True |
262 except socket.error as exc: |
262 except socket.error as exc: |
263 if exc.errno not in ( |
263 if os.name == 'nt' and exc.errno == errno.WSAEACCES: |
|
264 return False |
|
265 elif exc.errno not in ( |
264 errno.EADDRINUSE, |
266 errno.EADDRINUSE, |
265 errno.EADDRNOTAVAIL, |
267 errno.EADDRNOTAVAIL, |
266 errno.EPROTONOSUPPORT, |
268 errno.EPROTONOSUPPORT, |
267 ): |
269 ): |
268 raise |
270 raise |