title: How do I check if a remote host is reachable at a specific port in C?
body: <p>I am writing a C program to check whether remote host is responding to a specific port (In my case application is running on 9090 on remote side). Initially I tried<br>
  <code>nc -zv &lt;host&gt; &lt;port&gt;</code> using system() function call but unable to get the desired result. 
  Now, I have created a non-blocking socket and using a connect() call to check the same. But its returning -1 and setting errno -115 (Operation in progress)
  After searching on web I got the idea of using <code>select()</code> and <code>poll()</code>, but I am not able to get how to implement these. 
  Any suggestion with sample program will be helpful.</p>