Hole hole with boost :: asio

I tried to make a client server with a holey protocol. Therefore, I send my client IP port and client port to my server, and when the second user is connected, the server sends Ip and the port of the other client to both clients. So when I have this, I tried to establish a connection between my client and I have an error with boost :: asio

terminate called after throwing an instance of 'boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::system::system_error> >' 

what (): Service not found Canceled

here is my code

 std::vector<std::string> response; response = split(reply, ':'); std::cout << "name : " << response[0] << std::endl; std::cout << "adresse : " << response[1] << std::endl; std::cout << "port : " << response[2] << std::endl; udp::resolver::query query(udp::v4(), response[0], response[1]); std::cout << "resolved - - - -" << std::endl; struct client *cl = new struct client(); cl->endpoint_iterator = resolver.resolve(query); // It Crash HERE cl->sender_endpoint = *endpoint_iterator; cl->name = response[0]; _clients.push_back(cl); 
+6
source share
1 answer

check the parameters in the request.

You print response [1] as the host address and response [2] as the port. But you are building your request object with the response [0] as the host address and response [1] as the port / service.

I suspect “Service Aborted Not Found” means your hostname is not like the port number or service name.

See http://www.boost.org/doc/libs/1_50_0/doc/html/boost_asio/reference/ip__basic_resolver_query/basic_resolver_query/overload4.html

+1
source

Source: https://habr.com/ru/post/918336/


All Articles