websocketpp icon indicating copy to clipboard operation
websocketpp copied to clipboard

dns resolve time out,return Timer Expired,local_close_code return 1006

Open JCYAO-gz opened this issue 4 years ago • 1 comments

connect fail, con->get_ec().message() return "Timer Expired", get_local_close_code return 1006. because my url no ipv6 server,dns resolve ipv4+ipv6 time out.

in websocketpp\transport\asio\endpoint.hpp void async_connect(transport_con_ptr tcon, uri_ptr u, connect_handler cb) tcp::resolver::query query(host,port);

when i change tcp::resolver::query query(tcp::v4(),host,port) it can only dns resolve ipv4,and connect success.

if i can call some api or config to set dns only resolve ipv4 in my code ,instead change code in lib? thanks!

JCYAO-gz avatar May 10 '21 03:05 JCYAO-gz

Running into a similar issue here - when the DNS server gives a Refused response, asio/websocketpp somehow interprets this to give up connecting, yet it does have a valid IPv4 address.

Is there anyhow we can influence this tcp::resolver behavior? I couldn't find where it actually gives up on a non-noerr response.

minhtrietdiep avatar Jan 19 '24 15:01 minhtrietdiep