This is the code , if i make it check set ports by using for loop it runs very slow.
#include <iostream>
#include <SFML/Network.hpp>
#include <string>
static bool port_is_open(const std::string& address, int port)
{
return (sf::TcpSocket().connect(address, port) == sf::Socket::Done);
}
int main1()
{
if (port_is_open("127.0.0.1", 445))
std::cout << "OPEN" << std::endl;
else
std::cout << "CLOSED" << std::endl;
return 0;
}