Closed fusionJose closed 5 years ago
Here is everything I could see in the network, until the [FIN, ACK], also SSH communication with my app:
I'm not going to look at your code.
What about logs from lws?
Logs look like this:
I´m using QMAKE and I've configured he log level with all the flags:
Is there anything more that I can see?
Thanks.
Did you build with cmake having -DCMAKE_BUILD_TYPE=DEBUG?
I'm using qmake, is there any way to build it with it? If not I will install the cmake. Thank you
You can use what you want, it's foss.
But it's a bit brave just using qmake without referencing what cmake produces. You should at least follow the supported cmake flow and then do the make with V=1 VERBOSE=1 and see what the gcc commandline looks like.
And it's a bit presumptious dragging me along for the ride when you hit problems. Nobody said this works with qmake.
I´ve made the project with cmake, and still works the same. I´ve read the log and sais this:
[2019/06/25 10:54:11:6371] USER: Sending PING 93... [2019/06/25 10:54:11:6371] INFO: lws_issue_raw: ssl_capable_write (99) says 99 [2019/06/25 10:54:11:6373] INFO: rops_handle_POLLIN_ws: LWS_SSL_CAPABLE_ERROR [2019/06/25 10:54:11:6373] DEBUG: 0x9007428: Close and handled [2019/06/25 10:54:11:6373] INFO: lws_close_free_wsi: 0x9007428: caller: close_and_handled [2019/06/25 10:54:11:6373] DEBUG: __lws_close_free_wsi: real just_kill_connection: 0x9007428 (sockfd 6) [2019/06/25 10:54:11:6374] DEBUG: lwsi_set_state(0x9007428, 0x1000001e) [2019/06/25 10:54:11:6374] DEBUG: lws_close_free_wsi_final: wsi 0x9007428: fd 6 [2019/06/25 10:54:11:6374] INFO: lws_vhost_unbind_wsi: vh default: count_bound_wsi 0 [2019/06/25 10:54:11:6374] DEBUG: __lws_free_wsi: 0x9007428, remaining wsi 1 [2019/06/25 10:54:12:0409] DEBUG: _realloc: size 380: cbwsi [2019/06/25 10:54:12:0410] DEBUG: _realloc: size 24: cbtmr [2019/06/25 10:54:12:0410] DEBUG: lws_service_periodic_checks: timed cb: vh default, protocol lws-abs-cli-raw-skt, reason 1000
So it seems that after writing and sending the message it closes the socket. It calls to lws_close_free_wsi.
So it seems that after writing and sending the message it closes the socket. It calls to lws_close_free_wsi.
No... after sending it sees the socket had been closed by the remote peer.
So have a look at his logs.
Okey, but I don't understand the LWS_SSL_CAPABLE_ERROR issue. I have SSL disabled.
Openssl, mbedtls and no ssl all have their errors summarized into the same enum. Ssl-capable means it's an api that works the same (and produces the same internal error codes) whether its operating inside tls or not.
Of course the remote peer was closing.
I also noticed that the websocket client is sending in the HTTP header a Connection: close, upgrade, instead of only Connection: upgrade.
Is there anyway to change or configure the HTTP header? I saw in the libwebsockets code that comes from here:
if (!wsi->client_pipeline) conn1 = "close, "; p = lws_generate_client_ws_handshake(wsi, p, conn1);
Thank you
Connection: close, upgrade is perfectly correct.
If your server blows up with it, set the flag LCCSCF_PIPELINE
on client creation info .ssl_connection.
Okey, now works correctly. Thank you very much for all.
Hi, I wrote a client copied from minimal-ws-client-rx, but disabling SSL (TLS)
And transmiting an initial messege when I get connected to server:
But I found sniffing in the network that 1,5 miliseconds later of sending the message it sends a [FIN, ACK]:
So the server doesn't response to my client.
This doesn't happen in the minimal examples because they work with TLS:
Here is the code:
`/*
include
include
include
include
include
include
static int bExit; static int interrupted, rx_seen, test; static struct lws *client_wsi; static char ping[LWS_PRE + 250];
static int callback_dumb_increment(struct lws wsi, enum lws_callback_reasons reason, void user, void *in, size_t len) {
}
static const struct lws_protocols protocols[] = { { "ocpp1.6", callback_dumb_increment, 0, 0, }, { NULL, NULL, 0, 0 } };
static void sigint_handler(int sig) { interrupted = 1; }
int main(int argc, const char *argv) { struct lws_context_creation_info info; struct lws_client_connect_info i; struct lws_context context; const char p; int n = 0, logs = LLL_USER | LLL_ERR | LLL_WARN | LLL_NOTICE / for LLL_ verbosity above NOTICE to be built into lws, lws
instead of =RELEASE / / | LLL_INFO / / | LLL_PARSER / / | LLL_HEADER / / | LLL_EXT / / | LLL_CLIENT / / | LLL_LATENCY / / | LLL_DEBUG */;
}`
Any idea?
Thank you.