title: Checking if server process is listening on domain socket or not
body: <p>I'm writting client-server programs, that using unix domain socket for communicating between two  sides.
  The requirement is:</p>
  
  <ol>
  <li>Server opens an abstract socket on a given address, then listen on that. By some triggers, server can stop listening on that.</li>
  <li><p>Client has to monitor that Server is listening on given address path or not</p>
  
  <ul>
  <li>if server <strong>is listening on socket</strong> then send a register request to server</li>
  <li>if server <strong>close the socket</strong> then do some action cleaning up...</li>
  </ul></li>
  </ol>
  
  <p>To check the server is listening or not, my solution is:</p>
  
  <p>Periodically <strong>create a socket</strong> and <strong>connect to server address path</strong>, if succeed, then means that server is listening, and vice versa for any case of error.</p>
  
  <p>But the solution seems to be cpu-consuming if checking interval is too short.</p>
  
  <p><strong><em>Then my question is:</em></strong> do we have any method like registering some callback to system, and get the notification whenever some process starts/stops listening on a given address? or some other better suggestion...??</p>
  
  <p>Many thanks,</p>