Open bsilverajan opened 3 months ago
It seems that this can be fixed by building each socket using socket2 and setting nonblocking, reuse address and reuse port for each, then transforming into a tokio UdpSocket (using from_std) before binding. Doing this allows the broker to use port 5683 on unicast and multicast.
The fix also works with just reuse port
Basically in multicast, reuseaddr should work but for it isnt working quite as intended here.
Running the broker throws up an error :
thread 'main' panicked at src/main.rs:595:68: called
Result::unwrap()
on anErr
value: Os { code: 48, kind: AddrInUse, message: "Address already in use" } note: run withRUST_BACKTRACE=1
environment variable to display a backtracerunning on localhost for unicast and multicast causes this error.
Quick fix: change port number used by unicast and multicast addresses when creating a socket.