gunterhager / UDPBroadcastConnection

Framework to send UDP broadcast messages and listen to responses using a Dispatch source.
MIT License
84 stars 28 forks source link

Error "Can't assign requested address" #10

Closed Ricardo1980 closed 5 years ago

Ricardo1980 commented 5 years ago

Hello,

Sometimes I receive this error: "UDP connection failed to send data: Can't assign requested address" I think it is because I am changing to a different wifi network while I send packets. Is it related?

Maybe I have to recreate the socket when I see that kind of error.

Thanks.

gunterhager commented 5 years ago

When this error happens, the socket is closed automatically. So you should just send the message again. This will open a new socket, too. Unfortunately I didn't implement any error handling support when sending messages via sendBroadcast(). I think the function should throw when an error occurs.

gunterhager commented 5 years ago

Next version of UDPBroadcastConnection will allow to handle errors.