-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
If I want to connect to a server, does it have to be the same protocol between the server and the client? #3340
Comments
Read rfc6455 for info on how ws itself works, see section 1.9 for how subprotocol works. https://www.rfc-editor.org/rfc/rfc6455 Many servers take the lazy approach to just offer one, unnamed subprotocol, which lws can match with by choosing NULL on its side. |
Not sure about v4.3 based stuff but main branch lws (from git) sorts the DNS results according to various RFCs and compares the situation found from netlink about which nets (ipv4 and v6) are routable from available network interfaces. https://github.com/warmcat/libwebsockets/blob/main/lib/core-net/client/sort-dns.c There are many possible situations in the wild where, eg, ipv6 is present at a local network interface, but only link-local scope, or routes in the LAN OK but has no exit to the internet and so on. So it will do its best to choose the best bets first and retry through the list as it finds it is needed. |
At this time, the client is retransmitting the SYN packet, hoping to get the SYN ACK packet from the server. |
lws uses the network interface address information to choose which dest addresses have the best chance. If it reacts to it by discarding ipv6 it probably has a reason (or is buggy). main branch lws has the best code for all this stuff. It looks like it tries to write at mbedtls layer before the underlying socket is connected. Is, eg, your code trying to do an lws_write() before the underlying tcp socket is ready? |
In my configs, netlink is not enabled. In lws_sort_dns, it seems that the IP address is only put into the list without filtering. When the timeout period is exceeded and the client is still retransmitting the syn packet, lws seems to think that the TCP socket is ready and can perform mbedtls handshake. |
Are you using main branch? You should do so for this stuff. It has significant work not in v4.3. I don't think the code you point at is related. It's trying to see if there's no addresses in the list and no ongoing timeout to get addresses in the list, that we have essentially timed out. |
Hi, Andy, I just started learning libwebsocket. I have a question. If I want to connect to a server, does it have to be the same protocol between the server and the client? If I want to transmit data to some servers, such as
echo.websocket.org
, how should I do it?The text was updated successfully, but these errors were encountered: