CTool.h 422 B

12345678910111213141516171819202122
  1. #pragma once
  2. #define PORT_DOWN 49152
  3. #define PORT_UP 65535
  4. class CTool : public SSingleton<CTool>
  5. {
  6. public:
  7. CTool();
  8. ~CTool();
  9. uint16_t FindAvailableTcpPort(uint16_t begin = PORT_DOWN, uint16_t end = PORT_UP);
  10. uint16_t FindAvailableUdpPort(uint16_t begin = PORT_DOWN, uint16_t end = PORT_UP);
  11. private:
  12. std::vector<uint16_t> GetAllTcpConnectionsPort();
  13. std::vector<uint16_t> GetAllUdpConnectionsPort();
  14. };