[Libwebsockets] Client connection retry

Andy Green andy at warmcat.com
Fri Jun 10 12:19:06 CEST 2016



On 06/10/2016 04:30 PM, techi eth wrote:
> i am trying one case where server is not running but client trying to
> connect.In that case i am getting Client connection error & after that
> context is getting destroy automatically.I understand in that case i
> should get LWS_CALLBACK _WSI_DESTORY
> Is that's way libwebsocket is working ?
>
> Is their any internal retry done by library for connection to server ?
>
> After that if i try to reconnect immediately then i should be able to
> connect

Take a look at the test client sources, if that has a problem I can help 
you.  If not, take a look at how that works 
(./test-server/test-client.c) and align your sources with it.

$ libwebsockets-test-client http://noexist.nope
[2016/06/10 18:17:47:4843] NOTICE: libwebsockets test client - license 
LGPL2.1+SLE
[2016/06/10 18:17:47:4843] NOTICE: (C) Copyright 2010-2016 Andy Green 
<andy at warmcat.com>
[2016/06/10 18:17:47:4843] NOTICE: Initial logging level 7
[2016/06/10 18:17:47:4843] NOTICE: Libwebsockets version: 2.0.0 
agreen at build.warmcat.com-v2.0.0-61-g4b86352
[2016/06/10 18:17:47:4843] NOTICE: IPV6 not compiled in
[2016/06/10 18:17:47:4843] NOTICE: libev support compiled in but disabled
[2016/06/10 18:17:47:4843] NOTICE: libuv support not compiled in
[2016/06/10 18:17:47:4844] NOTICE:  Threads: 1 each 100000 fds
[2016/06/10 18:17:47:4856] NOTICE:  mem: platform fd map: 800000 bytes
[2016/06/10 18:17:47:4857] NOTICE:  Compiled with OpenSSL support
[2016/06/10 18:17:47:4857] NOTICE:  SSL disabled: no 
LWS_SERVER_OPTION_DO_SSL_GLOBAL_INIT
[2016/06/10 18:17:47:4857] NOTICE: Creating Vhost 'default' port -1, 2 
protocols
[2016/06/10 18:17:47:4857] NOTICE:  mem: per-conn:          600 bytes + 
protocol rx buf
[2016/06/10 18:17:47:4858] NOTICE:  canonical_hostname = build.warmcat.com
[2016/06/10 18:17:47:4858] NOTICE: using http mode (non-ws)
[2016/06/10 18:17:47:4858] NOTICE: http: connecting
[2016/06/10 18:17:47:7586] ERR: getaddrinfo failed
[2016/06/10 18:17:48:2592] NOTICE: lws_protocol_init
[2016/06/10 18:17:49:2603] NOTICE: http: connecting
[2016/06/10 18:17:49:2639] ERR: getaddrinfo failed
[2016/06/10 18:17:51:2662] NOTICE: http: connecting
[2016/06/10 18:17:51:2698] ERR: getaddrinfo failed
[2016/06/10 18:17:53:2720] NOTICE: http: connecting
[2016/06/10 18:17:53:2754] ERR: getaddrinfo failed
[2016/06/10 18:17:55:2776] NOTICE: http: connecting
[2016/06/10 18:17:55:2826] ERR: getaddrinfo failed
^C[2016/06/10 18:17:55:7285] ERR: Exiting
[2016/06/10 18:17:55:7285] NOTICE: lws_context_destroy

-Andy

>
> _______________________________________________
> Libwebsockets mailing list
> Libwebsockets at ml.libwebsockets.org
> http://libwebsockets.org/mailman/listinfo/libwebsockets
>



More information about the Libwebsockets mailing list