equal
deleted
inserted
replaced
236 try: |
236 try: |
237 s = socket.socket(family, socket.SOCK_STREAM) |
237 s = socket.socket(family, socket.SOCK_STREAM) |
238 s.bind(('localhost', port)) |
238 s.bind(('localhost', port)) |
239 s.close() |
239 s.close() |
240 return True |
240 return True |
241 except socket.error as exc: |
241 except (socket.error, OSError) as exc: |
242 if exc.errno == errno.EADDRINUSE: |
242 if exc.errno == errno.EADDRINUSE: |
243 return True |
243 return True |
244 elif exc.errno in (errno.EADDRNOTAVAIL, errno.EPROTONOSUPPORT): |
244 elif exc.errno in (errno.EADDRNOTAVAIL, errno.EPROTONOSUPPORT, |
|
245 errno.EAFNOSUPPORT): |
245 return False |
246 return False |
246 else: |
247 else: |
247 raise |
248 raise |
248 else: |
249 else: |
249 return False |
250 return False |