7 years, 2 months ago.

How to make restart UDP Socket if cable was unpluged?

Hello,

I have UDP communication with Static IP between two NucleoF767ZI and encountered problem if I unplug cable and plug it again Ethernet communication never restores.

Can anybody advice how to check if connection was lost? (may be through mbedEvents) and how to restart UDP Socket ?

Thank you, Daniel

1 Answer

7 years, 1 month ago.

So, UDP is just fire-and-forget, so there's not really a thing as 'restarting a socket'. There's no communication between the two nodes to set up the connection.

If you need to be sure that the communication channel is still there, use TCP and look for the error codes when calling send/recv (or use the events that the socket gives you).

At the moment need to use UDP, so will need to think about another solution. Thank you for reply.

posted by Daniel Klioc 14 Nov 2017