title: How to limit the range of ports that QTcpServer is using for listening?
body: <p>I have an application that uses QTcpServer to listen for incoming connections. There are actually multiple processes running simultaneously, so i just do:</p>
  
  <pre><code>QTcpServer *server = new QTcpServer;
  server-&gt;listen(QHostAddress::Any, 0);
  </code></pre>
  
  <p>and if that succeeds, i just ask the server about the port that it's listening to. Since the port is chosen automatically, now I need to limit it's range. For example, I want it to automatically choose a port between 25000 and 26000. Is there a good way I can do it, or should i just keep trying to listen to any of the ports in the range, and until I succeed to keep changing the port? It is a solution, but a brute-force one. So, if there's a better way, I would really like to know.</p>
  
  <p>Thanks</p>