Reputation: 31
I use websocketpp in my program as websocket server.But recently in some users' environment when I listenning on some specific port,an error happened,I print the message of error_code,it's "Underlying Transport Error",Is that means the listening has prevented by some firewall on 3rd party security software? The code is as below:
std::error_code ec;
server_->set_message_handler(boost::bind(&on_message, server_, ::1, ::2));
server->set_tls_init_handler(boost::bind(&on_tls_init,MOZILLA_INTERMEDIATE,::1));
server->init_asio(ec);
server->listen(2007 , ec);
after executed init_asio, there is no error returned,But after listen,the error appeared.
Thanks all
Upvotes: 3
Views: 5659
Reputation: 3378
Firstly ensure that your program is not swallowing up any of the logging information from websocketpp. For example, the commented lines below would block logging:
websocketpp::server<websocketpp::config::asio> server;
//server.set_access_channels(websocketpp::log::alevel::none);
//server.set_error_channels(websocketpp::log::elevel::none);
Then, when you're running the program you should get something like this:
[2018-07-25 10:33:10] [info] asio listen error: system:98 (Address already in use)
This corresponds to the error codes in: boost/asio/error.hpp
. See also: Boost error codes reference
My guess would be you have two instances of the program trying to run on the same port.
Upvotes: 2