Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kezhengjie/checkport
a tiny tool lib written in c++ based on asio for iterating and checking tcp port.
https://github.com/kezhengjie/checkport
asio check-port cpp cross-platform fast fluent linux modern simple-api tcp-port-checker tcp-port-scanner tiny windows
Last synced: 6 days ago
JSON representation
a tiny tool lib written in c++ based on asio for iterating and checking tcp port.
- Host: GitHub
- URL: https://github.com/kezhengjie/checkport
- Owner: kezhengjie
- License: mit
- Created: 2022-08-09T03:19:49.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-08-09T05:41:15.000Z (over 2 years ago)
- Last Synced: 2024-12-25T03:22:13.997Z (10 days ago)
- Topics: asio, check-port, cpp, cross-platform, fast, fluent, linux, modern, simple-api, tcp-port-checker, tcp-port-scanner, tiny, windows
- Language: C++
- Homepage:
- Size: 866 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# checkport
a tiny tool lib written in c++ based on asio for iterating and checking tcp port.## Usage
```
// define this to enable checkport header only mode
#define CHECK_PORT_HEADER_ONLY
#include "checkport.h"
#includeint main(int argc, char** argv)
{
// Constructor requires ip and port range.
checkport::CheckPort cp("127.0.0.1", 1, 4000);// Set connect timeout.Consider fail if connecting port timeout.
cp.SetConnectTimeout(1);// Set max concurrency.Increase this will improve check speed.
cp.SetConcurrency(100);// Return 0 if no port is accessable in the port range
// Or any number larger than 0 indicates the first accessable port in the range.
auto port = cp.GetOne();if (port == 0)
std::cout << "no port is accessable" << std::endl;
else
std::cout << port << " is accessable" << std::endl;// Return vector holds every accessable port in the range.
auto port_list = cp.GetAll();
for (const auto& v : port_list)
std::cout << v << " ";
return 0;
}
```