/******************************************************************************
* libwebsockets 运行问题
* 说明:
* 编译发现libwebsockets运行出问题,解决一下。
*
* 2017-6-28 深圳 龙华樟坑村 曾剑锋
*****************************************************************************/ 一、错误现象:
. Run error message:
[zengjf@root ~]# ./lwsserver
Parse local config over, member size:
[// :::] NOTICE: Initial logging level
[// :::] NOTICE: Libwebsockets version: 1.7. zengjf@zengjf-
[// :::] NOTICE: IPV6 not compiled in
[// :::] NOTICE: libev support not compiled in
[// :::] NOTICE: Threads: each fds
[// :::] NOTICE: mem: platform fd map: bytes
[// :::] NOTICE: mem: per-conn: bytes + protocol rx buf
[// :::] NOTICE: canonical_hostname = zengjf
[// :::] NOTICE: Compiled with OpenSSL support
[// :::] NOTICE: Using non-SSL mode
[// :::] NOTICE: OpenSSL doesn't support ECDH
[// :::] NOTICE: Listening on port
starting server with thread: ... . Browser error message:
VM900: WebSocket connection to 'ws://localhost:9000/' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED 二、解决办法:
. cat package/libwebsockets/libwebsockets.mk
...
LIBWEBSOCKETS_CONF_OPTS = -DLWS_WITHOUT_TESTAPPS=ON -DLWS_IPV6=OFF -DLWS_SSL_SERVER_WITH_ECDH_CERT=ON
... . cat output/build/libwebsockets-v1.7.5/CMakeLists.txt
...
if (LWS_SSL_SERVER_WITH_ECDH_CERT)
set(LWS_SSL_SERVER_WITH_ECDH_CERT )
endif()
... . cat output/build/libwebsockets-v1.7.5/lws_config.h
...
/* Build with support for ipv6 */
#undef LWS_USE_IPV6
...
/* SSL server using ECDH certificate */
#define LWS_SSL_SERVER_WITH_ECDH_CERT
...
05-11 22:53