Closed Furujiang closed 5 years ago
It blocks on DNS lookup, that's the only thing blocking. It's a valid issue for uSockets too, I haven't solved it yet. DNS lookup should happen in a thread pool.
Thank you for quick response, I changed my design to use uws in multithread because I found it don't work for creating multi group and make connect calls, only last connect call works. It works well in each thread for 1 hub. Thank you again!
You shouldn't hack with threading. If you require nonblocking DNS lookup then do that part yourself with a third party library and pass the IP to connect
the main problem for single thread is: below code only connect to url2 will work fine, no callback recieved from url1, is this a bug? thank you!
sample code:
hub = new Hub();
group1 = hub->createGroup
group2 = hub_->createGroup
Well since the first connection will block on DNS resolution the second connection might time out? Both should work.
Hi I could not find a place to quest under uWebsocket, so I post it here: On winodws 10, while calling hub.connect to wws, it will block several seconds. if I add predefine SOCK_CLOEXEC;SOCK_NONBLOCK; to project, error occured with identifier "accept4" not found error.
I am using the hub to connect to multi wws, so I need this "connect" function excute as nonblocking, could you please advice? thank you!