Skip to content

Commit

Permalink
Must set SO_REUSEADDR before binding socket.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike Fahl committed Oct 24, 2022
1 parent 216e8b3 commit d501599
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/artnet_socket.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ def connect(self):
"""Connect to Artnet UDP socket"""
try:
self._socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) # UDP
self._socket.bind((UDP_IP, UDP_PORT))
self._socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
self._socket.bind((UDP_IP, UDP_PORT))
# blocking socket as we're listening in a background thread
self._socket.setblocking(1)
self._socket.settimeout(1) # 1 second timeout
Expand Down

0 comments on commit d501599

Please sign in to comment.