UDP failure detection system

Hi guys I have started implementing failure detection system.
I have created three hosts and we will start UDP client and UDP server
in each host and they will communicate with each other through UDP
messages.
I have written some code for UDP communication. Please have a look at it
and let me know if I am on correct path or not.

Regards,
Sohan