warmcat / libwebsockets

canonical libwebsockets.org networking library
https://libwebsockets.org
Other
4.77k stars 1.49k forks source link

Hep needded with LWS_CALLBACK_WSI_CREATE #3202

Closed liar-c closed 1 month ago

liar-c commented 2 months ago

I'm trying to connect a server on windows 10. When I run "lws_service" loop right after "wsi = lws_client_connect_via_info(&ccinfo)" , it seeems socket handshaking is not done yet, but the client is trying to connect, so i got the message: "lws_client_connect_check: errno 10022". Then the event LWS_CALLBACK_EVENT_WAIT_CANCELLED is triggered, so i have to wait for the connection time out, then i can get the event LWS_CALLBACK_WSI_CREATE. After that, eveerything goes right. However, it takes so much time to connect to the server. How can I solve this problem? Thank you! The code in every line represents the callback reason in lws-callbacks.h
issue

lws-team commented 2 months ago

Then the event LWS_CALLBACK_EVENT_WAIT_CANCELLED is triggered, so i have to wait for the connection time out, then i can get the event LWS_CALLBACK_WSI_CREATE.

These things are not directly related, but you use 'so' as if they were.

EVENT_WAIT_CANCELLED is something telling us to stop just waiting for something to happen and let your code run. Afterwards (or if no code to run) it will go back to waiting. AFAIK it doesn't itself also cause any problem or kill the connection attempt or cause windows to tell us about 10022, which is "invalid argument".

Something else may be dropping the initial connect, eg, firewall on your windows box or outside it? Or otherwise making what windows recognizes as a problem.

liar-c commented 2 months ago

Something else may be dropping the initial connect, eg, firewall on your windows box or outside it? Or otherwise making what windows recognizes as a problem. Thanks, I will try to close the firewall later.