| from _pydev_imps import _pydev_socket as socket |
| Should return 127.0.0.1 in ipv4 and ::1 in ipv6 |
| localhost is not used because on windows vista/windows 7, there can be issues where the resolving doesn't work |
| properly and takes a lot of time (had this issue on the pyunit server). |
| Using the IP directly solves the problem. |
| #TODO: Needs better investigation! |
| for addr_info in socket.getaddrinfo("localhost", 80, 0, 0, socket.SOL_TCP): |
| if config[0] == '127.0.0.1': |
| #Ok, some versions of Python don't have getaddrinfo or SOL_TCP... Just consider it 127.0.0.1 in this case. |
| sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) |
| sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) |
| return sock.getsockname() |