makesite icon indicating copy to clipboard operation
makesite copied to clipboard

socket.error: [Errno 98] Address already in use

Open DamonDBT opened this issue 7 years ago • 5 comments

i run your code on debian with python 2.7. And it throw an error : socket.error: [Errno 98] Address already in use i change the ip:port to my server ip+new port. but the error still exist. i search the question online . someonte say to add one line code below , but i can't find where to add , self.recSocket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
self.recSocket.settimeout(CHECK_TIMEOUT) self.recSocket.setsockopt(socket.SOL_SOCKET,socket.SO_REUSEADDR,1)
self.recSocket.bind(('', UDP_PORT))
the url: https://blog.csdn.net/chenyulancn/article/details/8181238 hope you can help me. Thanks.

DamonDBT avatar Apr 27 '18 06:04 DamonDBT

问题解决了,是因为有个用bottle启动的web程序占用了8000端口,而SimpleHTTOServer默认也是8000端口

DamonDBT avatar May 03 '18 14:05 DamonDBT

Address already in use means that you have another Python HTTP server running on the machine

gabfl avatar May 03 '18 15:05 gabfl

@gabfl yes, or any other service which binds to that specific port

wsw70 avatar Jul 06 '18 18:07 wsw70

correct, indeed

gabfl avatar Jul 06 '18 18:07 gabfl

@DamonDBT you have something running on the default port used by the built-in Python web server (namely 8080). Try to start your server with

python -m SimpleHTTPServer 9977

For python 3.x this would be

python -m http.server 9977

or

python3 -m http.server 9977

Your site will the be at http://localhost:9977. You can use any other port not used by another service.

wsw70 avatar Jul 06 '18 18:07 wsw70