title: How to list open ports in iOS?
body: <p>I am using a <strong>*jailbroken</strong> device and I want to <strong>write an application</strong> to list the open ports (e.g. TCP ports).</p>
  
  <p>I have two ideas:</p>
  
  <ul>
  <li>Use some native API to get list of opened ports</li>
  <li>execute shell command to get a list of opened ports and parse the result of this shell command.</li>
  </ul>
  
  <p>Which API or shell command should I use and how can I trigger it programmatically?</p>