close

[Fixed] Python [Errno 98] Address already in use

Today We are Going To Solve Python [Errno 98] Address already in use in Python. Here we will Discuss All Possible Solutions and How this error Occurs So let’s get started with this Article.

How to Fix Python [Errno 98] Address already in use Error?

  1. How to Fix Python [Errno 98] Address already in use Error?

    To Fix Python [Errno 98] Address already in use Error just Set SO_REUSEADDR option on a socket. Here you have to just set SO_REUSEADDR option on a socket. You can see this in my below example. I hope this will help you. sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)

  2. Python [Errno 98] Address already in use

    To Fix Python [Errno 98] Address already in use Error just Run the command. To solve this error just run the below commands: Bash: kill -9 $(ps -A | grep python | awk '{print $1}') Fish: kill -9 (ps -A | grep python | awk '{print $1}')

Solution 1 : Set SO_REUSEADDR option on a socket

Here you have to just set SO_REUSEADDR option on a socket. You can see this in my below example. I hope this will help you.

sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)

Solution 2 : Run the command

To solve this error just run the below commands:

Bash:

kill -9 $(ps -A | grep python | awk '{print $1}')

Fish:

kill -9 (ps -A | grep python | awk '{print $1}')

Conclusion

So these were all possible solutions to this error. I hope your error has been solved by this article. In the comments, tell us which solution worked? If you liked our article, please share it on your social media and comment on your suggestions. Thank you.

Also Read These Solutions

1 thought on “[Fixed] Python [Errno 98] Address already in use”

Leave a Comment