2 years, 4 months ago.

How to make restart UDP Socket if cable was unpluged?


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

2 years, 3 months 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