title: How to know if a port is open or not in Linux system
body: <p>I need to find whether a port Ex. port 8080 is opened on a Linux system. I'm looking for a C or C++ API call that will return true or false or the equivalent when given a port number. This only needs to run locally. I don't want to know if there is a process listening on the port, only that is not blocked by the firewall.</p>
  
  <p>I want to do the equivalent of</p>
  
  <pre><code> if( ! IsPortOpen(8080))
       cout &lt;&lt; "please request IT to open port 8080 before running this tool";
       exit(1);
   }
  </code></pre>