I decided to use them both!
Simple use case:
In order to communicate with TCP
prococol you have to establish a connection which you can have only if you know IP
and Port
on both ends.
If you do not have that information when you load your Application, then you use the UDP
to Broadcast your IP
address and your intention to find the/a Server. You may try about 5 times before you raise the user an error telling that you did not find the Server or that the Server is down.
Sending that message in UDP
will (one time or other) reach the UDP
ear of the Server, which will now know the IP from the lonely Client's IP
and will now begin a proper connection via TCP
to be read talk about the critical messages of the Application.
What do you think of that approach?