Assume your socket is named s
… you need to set socket.SO_REUSEADDR
on the server’s socket before binding to an interface… this will allow you to immediately restart a TCP server…
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
s.bind((ADDR, PORT))
More Related Contents:
- Getting MAC Address
- Basic Python client socket example
- Can Python select what network adapter when opening a socket?
- Python socket.accept nonblocking?
- Sending a reset in TCP/IP Socket connection
- Python [Errno 98] Address already in use
- Get local network interface addresses using only proc?
- Sending a file over TCP sockets in Python
- Unwanted RST TCP packet with Scapy
- Socket Programming Python: How to make sure entire message is received?
- Socket Programming Python: How to make sure entire message is received?
- What is “backlog” in TCP connections?
- Sockets On Same Machine For Windows and Linux
- Why does multiprocessing use only a single core after I import numpy?
- Shebang Notation: Python Scripts on Windows and Linux?
- python-dev installation error: ImportError: No module named apt_pkg
- Ensure a single instance of an application in Linux
- Force python to use an older version of module (than what I have installed now)
- Python multiprocessing: Permission denied
- Opening a SSL socket connection in Python
- Python server “Only one usage of each socket address is normally permitted”
- How to store the result of an executed shell command in a variable in python? [duplicate]
- Test if an internet connection is present in python
- How do I ‘lock the keyboard’ to prevent any more keypresses being sent on X11/Linux/Gnome?
- gunicorn command not found, but it’s in my requirements.txt
- Fetching the output of a command executed through os.system() command [duplicate]
- How to change tcp keepalive timer using python script?
- Pyaudio installation error – ‘command ‘gcc’ failed with exit status 1′
- how to find the owner of a file or directory in python
- How can I set the matplotlib ‘backend’?