On 27Jun2018 10:44, Tamara Berger <brg...@gmail.com> wrote:
On Wednesday, June 27, 2018 at 1:40:20 PM UTC-4, Marko Rauhamaa wrote:
Joaquin Henriquez <joaquin.henriq...@countercept.com>:

>>Subject: EXTERNAL: OSError: [Errno 48] Address already in use
> The best way to help if got you to put the relevant code here.
>
> The error you are experiencing means that the Port you are trying to
> bind is already taken by another running process.

That error usually takes place when restarting a server. The server
exited with one or more TCP connections open, which left the connections
in a TIME-WAIT state for some minutes. When the server is restarted and
tries to bind its address again, the ghosts of the previous connections
prevent the socket from being bound.

The problem can be solved by turning on the SO_REUSEADDR flag of the
socket.

Can you please tell me how to "turn on the SO_REUSEADDR flag of the socket"?

There's an example at the very bottom of the documentation for the "socket" module:

 https://docs.python.org/3/library/socket.html

However, Flash likely creates the server socket for you; I don't know how to tell it to set the SO_REUSEADDR option, though the flask documentation might.

You can check the status of the system with the netstat(8) command:

 netstat -an

lists all the system sockets and connections running on your machine. There will be many, so if you know the port you're using you can narrow it does with a grep:

 netstat -an | grep 8000

if you were using port 8000.

This also points the way to a workaround: since you're running the script yourself on an ad hoc basis, change ports! Maybe provide the listening port on the command line, and just bump it by one when this happens.

Cheers,
Cameron Simpson <c...@cskk.id.au>
--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to