Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 606675
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T17:16:46+00:00 2026-05-13T17:16:46+00:00

As a follow-up to cannot-bind-to-address-after-socket-program-crashes , I was receiving this error after my program

  • 0

As a follow-up to cannot-bind-to-address-after-socket-program-crashes, I was receiving this error after my program was restarted:

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

In this particular case, instead of using a socket directly, the program is starting its own threaded TCP server:

httpd = SocketServer.ThreadingTCPServer(('localhost', port), CustomHandler)
httpd.serve_forever()

How can I fix this error message?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T17:16:46+00:00Added an answer on May 13, 2026 at 5:16 pm

    In this particular case, .setsockopt(SOL_SOCKET, SO_REUSEADDR, 1) may be called from the TCPServer class when the allow_reuse_address option is set. So I was able to solve it as follows:

    httpd = SocketServer.ThreadingTCPServer(('localhost', port), CustomHandler, False) # Do not automatically bind
    httpd.allow_reuse_address = True # Prevent 'cannot bind to address' errors on restart
    httpd.server_bind()     # Manually bind, to support allow_reuse_address
    httpd.server_activate() # (see above comment)
    httpd.serve_forever()
    

    Anyway, thought this might be useful. The solution will differ slightly in Python 3.0

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I cannot figure out this positioning problem in Firefox. It doesn't seem to follow
Cannot get to bind Enter to newline-and-indent in Emacs !!! Very annoying. I already
In follow up to this question , it appears that some numbers cannot be
I cannot follow crossval() & cvpartition() function given in MATLAB documentation crossval() . What
my curl function cannot follow the redirection of Facebook external link redirector, l.php and
Question is very simple: I cannot install RVM (single-user installation), as if I follow
follow up: while I had already been using swfobject with static publishing, dynamic publishing
Follow up to this question . I have the following code: string[] names =
I am trying to use databinding to bind data to a Silverlight toolkit chart.
This question is a follow-up on a question about Python variable scope . Additional

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.