Hello,
while connecting to a TCP server with a websocket, i am unable to receive a handshake. esp_transport_connect() function fails, errno = 128, esp-tls error code - 0x8008, ESP_ERR_ESP_TLS_TCP_CLOSED_FIN. Logs "Error read response for Upgrade header GET / HTTP/1.1".
Could someone lead me towards elimination of this problem? I am unable to find a lot of information about this error and not able to understand it completely. Is there something crucial I could be missing?
Using esp-idf v5.0 framework, have migrated the espressif esp_websocket_client library.
Any help is appreciated, thanks in advance
Saulius J
error while connecting to server via WebSocket, esp-wrover-b
-
- Posts: 1709
- Joined: Mon Oct 17, 2022 7:38 pm
- Location: Europe, Germany
Re: error while connecting to server via WebSocket, esp-wrover-b
You mean "HTTP server", right?connecting to a TCP server with a websocket
https://en.wikipedia.org/wiki/HTTP/1.1_ ... _WebSocket
Does the server support WebSockets?
Re: error while connecting to server via WebSocket, esp-wrover-b
in my knowledge, a HTTP server is a TCP server, just one level higher.
Yes, the server is able to receive WS connections. However, when connecting to the correct uri, the server does not see the connection, however, the error is, as mentioned before, ESP_ERR_ESP_TLS_TCP_CLOSED_FIN. From what I google'd, "<..> 0x8008 means ESP_ERR_ESP_TLS_TCP_CLOSED_FIN. In other words, a TCP connection had been established successfully but unexpectedly, the connection has been closed by the server. This is often caused by the server software crashing, or restarting in some way. When a server process is terminated, the operating system will cleanup after it and close all connections.<...>"
I am unable to find a solution to this problem. Any (even the smallest of) tips are appreciated !
Yes, the server is able to receive WS connections. However, when connecting to the correct uri, the server does not see the connection, however, the error is, as mentioned before, ESP_ERR_ESP_TLS_TCP_CLOSED_FIN. From what I google'd, "<..> 0x8008 means ESP_ERR_ESP_TLS_TCP_CLOSED_FIN. In other words, a TCP connection had been established successfully but unexpectedly, the connection has been closed by the server. This is often caused by the server software crashing, or restarting in some way. When a server process is terminated, the operating system will cleanup after it and close all connections.<...>"
I am unable to find a solution to this problem. Any (even the smallest of) tips are appreciated !
Re: error while connecting to server via WebSocket, esp-wrover-b
I think I found my problem - I was trying to upgrade TCP to WS, without going TCP -> HTTP first.
Going to check whether that was the problem.
Going to check whether that was the problem.
-
- Posts: 1709
- Joined: Mon Oct 17, 2022 7:38 pm
- Location: Europe, Germany
Re: error while connecting to server via WebSocket, esp-wrover-b
client and server getting "out-of-sync" with a common protocol, or using incompatible protocols, where the client sends a certain request to the server and expects a certain response, while the server does not understand the request, possibly returns an error response (which the client does not recognize), and then closes the connection.connection had been established successfully but unexpectedly, the connection has been closed by the server. This is often caused by
Not sure what you mean by that. Normally, you'd use an HTTP client to connect and communicate with an HTTP server, without ever touching the TCP layer (aside from potentially specifying a (TCP) port number with the URL). The HTTP client should also handle the TLS layer between TCP and HTTP for you, which you really don't want to do yourself.trying to upgrade TCP to WS, without going TCP -> HTTP first.
Maybe check out https://components.espressif.com/compon ... ket_client
Who is online
Users browsing this forum: No registered users and 91 guests