Closed constant-flow closed 3 years ago
Unfortunately, I can not reproduce this issue with your code on Win10 20H2 or Debian 11 (Kernel 5.10.0).
This should actually work, but some platforms do not allow the reuse of ports. Sometimes this works with simply waiting a bit between stopping and creating a new sender.
(What should be working is to use one sender instance and start
and stop
it as needed, as this does not create a new UDP socket).
Does the following code work (i.e. does nothing) on your platform or does it throw an execption?
tmp_socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
tmp_socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
I tested on Mac OS Big Sur 11.4 The two lines you suggest don't throw an exception.
I also tested without recalling the constructor, also this works.
Calling the destructor for sender didn't help
Could you check if the behavior changes with version v1.8.1
?
I also tested without recalling the constructor, also this works.
I guess you mean calling stop()
and then start()
afterwards? This should no longer work in v1.8.1
.
Thx for the fix. Calling stop()
then start()
works now without an exception (v1.8.1
) .
Concerning the destructor: This was another thing i just tested if it would help to shut down the socket ... in fact it didn't help (typo on my end).
Keep up the good work.
First of all, thx for this great lib, works great. Unfortunately, closing seems to miss something as the
Address already in use
kicks in, when I restart the connection.I simply used the example and tried to run it twice
Repro
results in