Show More
@@ -141,16 +141,15 b' def checkportisavailable(port):' | |||||
141 | family = socket.AF_INET6 |
|
141 | family = socket.AF_INET6 | |
142 | else: |
|
142 | else: | |
143 | family = socket.AF_INET |
|
143 | family = socket.AF_INET | |
144 |
|
|
144 | try: | |
145 | try: |
|
145 | s = socket.socket(family, socket.SOCK_STREAM) | |
146 | s = socket.socket(family, socket.SOCK_STREAM) |
|
146 | s.bind(('localhost', port)) | |
147 | s.bind(('localhost', port)) |
|
147 | s.close() | |
148 | s.close() |
|
148 | return True | |
149 | return True |
|
149 | except socket.error as exc: | |
150 | except socket.error as exc: |
|
150 | if exc.errno not in (errno.EADDRINUSE, errno.EADDRNOTAVAIL, | |
151 | if exc.errno not in (errno.EADDRINUSE, errno.EADDRNOTAVAIL, |
|
151 | errno.EPROTONOSUPPORT): | |
152 | errno.EPROTONOSUPPORT): |
|
152 | raise | |
153 | raise |
|
|||
154 | return False |
|
153 | return False | |
155 |
|
154 | |||
156 | closefds = os.name == 'posix' |
|
155 | closefds = os.name == 'posix' |
General Comments 0
You need to be logged in to leave comments.
Login now