socket.error: [Errno 98] Address already in use
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.
问题解决了,是因为有个用bottle启动的web程序占用了8000端口,而SimpleHTTOServer默认也是8000端口
Address already in use means that you have another Python HTTP server running on the machine
@gabfl yes, or any other service which binds to that specific port
correct, indeed
@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.