Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
DamonDBT opened this issue Apr 27, 2018 · 5 comments
Open

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

DamonDBT opened this issue Apr 27, 2018 · 5 comments

Comments

@DamonDBT
Copy link

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
Copy link
Author

DamonDBT commented May 3, 2018

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

@gabfl
Copy link
Contributor

gabfl commented May 3, 2018

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

@wsw70
Copy link

wsw70 commented Jul 6, 2018

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

@gabfl
Copy link
Contributor

gabfl commented Jul 6, 2018

correct, indeed

@wsw70
Copy link

wsw70 commented Jul 6, 2018

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants