[Libwebsockets] R: Unable to connect to the server with Android

Andy Green andy at warmcat.com
Wed Apr 17 10:01:36 CEST 2019



On 17/04/2019 15:55, Stefano Mora wrote:
> Thanks Andy,
> this morning I had a 'git pull' (some files was updated) and then rebuilt the library adding the DEBUG option.
> Cmake worked well but when I compile by make I have the following error:
> 
> $ cd build
> $ cmake –DCMAKE_INSTALL_PREFIX:PATH=/usr -DCMAKE_BUILD_TYPE=DEBUG ..

cmake aggressively caches these settings into ./build/CMakeCache.txt... 
although you don't have it on your cmake commandline...

> ...
> ...
> LWS_WITH_PEER_LIMITS = OFF
>   LWS_HAVE_ATOLL = 1
>   LWS_HAVE__ATOI64 =
>   LWS_HAVE_STAT32I64 =
>   LWS_HAS_INTPTR_T = 1
>   LWS_WITH_EXPORT_LWSTARGETS = ON
> ---------------------------------------------------------------------
> -- Configuring done
> -- Generating done
> -- Build files have been written to: /home/mora/Desktop/Socket/libwebsockets/build
> mora at ubuntu-virtualbox:~/Desktop/Socket/libwebsockets/build$
> mora at ubuntu-virtualbox:~/Desktop/Socket/libwebsockets/build$ make
> Scanning dependencies of target websockets_shared
> [  1%] Building C object CMakeFiles/websockets_shared.dir/lib/core/alloc.c.o
> In file included from /home/mora/Desktop/Socket/libwebsockets/lib/core/alloc.c:1:0:
> /home/mora/Desktop/Socket/libwebsockets/lib/core/private.h:272:24: error: field ‘set’ has incomplete type
>    struct http2_settings set;

at some point you enabled HTTP2

#if defined(LWS_WITH_HTTP2)
	struct http2_settings set;
#endif

The best way is delete ./build/CMakeCache.txt and run cmake again with 
the options you want (HTTP2 is fine, but it looks like the Makefile your 
original version's cmake built is no good for current master).  Deleting 
CMakeCache.txt will regenerate the build pieces using only the current 
stuff.

-Andy

>                          ^~~
> CMakeFiles/websockets_shared.dir/build.make:62: recipe for target 'CMakeFiles/websockets_shared.dir/lib/core/alloc.c.o' failed
> make[2]: *** [CMakeFiles/websockets_shared.dir/lib/core/alloc.c.o] Error 1
> CMakeFiles/Makefile2:99: recipe for target 'CMakeFiles/websockets_shared.dir/all' failed
> make[1]: *** [CMakeFiles/websockets_shared.dir/all] Error 2
> Makefile:151: recipe for target 'all' failed
> make: *** [all] Error 2
> 
> My machine is a Ubuntu 18.04.2 LTS (Virtual machine)
> 
> 
> -----Messaggio originale-----
> Da: Andy Green <andy at warmcat.com>
> Inviato: martedì 16 aprile 2019 16:59
> A: Stefano Mora <stefano.mora at newdep.com>; libwebsockets at ml.libwebsockets.org
> Oggetto: Re: [Libwebsockets] Unable to connect to the server with Android
> 
> 
> 
> On 16/04/2019 22:52, Stefano Mora wrote:
>> Hello,
>> I developed a ws server based on minimal sample: it is running on a Linux board.
>> When I connect with browsers everything is OK.
>> Now I'd like to connect with Android app and I'm using org.java-websocket:Java-WebSocket library.
>>
>> When I connect the app to the server the onOpen callback is fired with the 101 code and 'Switching Protocols' as message.
>> The server does not enter in the ESTABLISHED phase and nothing else happen.
> 
> It sounds like you should watch the lws logging.
> 
> Build it with cmake -DCMAKE_BUILD_TYPE=DEBUG and enable all the log types (like -d 1151 or so) and take a closer look at if the logs contain a clue about how lws feels about the connection.
> 
> -Andy
> 


More information about the Libwebsockets mailing list