title: Custom Service Discovery
body: <p>I am trying to write a service discovery protocol for my communication framework. I am planning to do the following steps:</p>
  
  <p><strong>Server Side</strong></p>
  
  <ol>
  <li>Creating a multicast socket </li>
  <li>Join a group</li>
  <li>Broadcast(Send multicast message with some heart-beat [UDP Multicast Protocol]. The broadcast data contains server IP and some port which will be used to process client registration requests</li>
  <li>Open thread to receive TCP packets from Client on that port to accept registrations</li>
  </ol>
  
  <p><strong>Client Side</strong></p>
  
  <ol>
  <li>Creating Multicast socket</li>
  <li>Join the same multicast group as server to receive messages</li>
  <li>Check for relevant broadcast from service</li>
  <li>Get data from the broadcast packet (Data is server IP and Port)</li>
  <li>Make a TCP Call to server(IP and port received) in the form of registration request. </li>
  </ol>
  
  <p>Regarding security vulnerability, I can provide certificates in client registration step to protect that, but my <strong>main concern is in service broadcast</strong>.</p>
  
  <p>If I broadcast server IP and port in a heartbeat that is very dangerous to attacks like port flooding etc.(I can provide some security measure but heavy-weight encryption and decryption will make service discovery lag). Is there any alternative design?</p>