Errno 98 address already in use

Errno 98 address already in use

Want to improve this question? Add details and clarify the problem by editing this post.

Closed 6 years ago .

when i setup, it shows that socket.error: [Errno 98] Address already in use.

1 Answer 1

There is obviously another process listening on the port. You might find out that process by using the following command:

or change your tornado app’s port. tornado’s error info not Explicitly on this.

In my Python socket program, I sometimes need to interrupt it with Ctrl-C . When I do this, it does close the connection using socket.close() .

However, when I try to reopen it I have to wait what seems like a minute before I can connect again. How does one correctly close a socket? Or is this intended?

7 Answers 7

Yes, it is intended. Here you can read detailed explanation. It is possible to override this behavior by setting SO_REUSEADDR option on a socket. For example:

If you use a TCPServer, UDPServer or their subclasses in the SocketServer module, you can set this class variable (before instanciating a server):

This causes the init (constructor) to:

because you trying to run service in same port that is already running.

some time its happen because your service is not stopped in process stack. you have to kill them

no need to install anything here is the one line command to kill all running python processes.

for Linux based OS:

Nothing worked for me except running a subprocess with this command, before calling HTTPServer((», 443), myHandler):

kill -9 $(lsof -ti tcp:443)

Of course this is only for linux-like OS!

A simple solution that worked for me is to close the Terminal and restart it.

Читайте также:  Hdmi не передает изображение на телевизор

I have this code to connect with server, and this is on server, i have another file py at client but not test yet, i got problem when run this code, please see the information below

And when I run it, it show me an Error, I think it is about socket to connect with IP server, is it right?

How can I fix that? Any suggest? Thanks in advance

Ссылка на основную публикацию
Adblock detector