libwebsockets 运行问题

/******************************************************************************
 *                        libwebsockets 运行问题
 * 说明:
 *     编译发现libwebsockets运行出问题,解决一下。
 *
 *                                         2017-6-28 深圳 龙华樟坑村 曾剑锋
 *****************************************************************************/

一、错误现象:
    1. Run error message:
        [zengjf@root ~]#  ./lwsserver 
        Parse local config over, member size: 8
        [2017/03/16 18:35:09:7201] NOTICE: Initial logging level 7
        [2017/03/16 18:35:09:7202] NOTICE: Libwebsockets version: 1.7.5 zengjf@zengjf-
        [2017/03/16 18:35:09:7202] NOTICE: IPV6 not compiled in
        [2017/03/16 18:35:09:7203] NOTICE: libev support not compiled in
        [2017/03/16 18:35:09:7205] NOTICE:  Threads: 1 each 1024 fds
        [2017/03/16 18:35:09:7205] NOTICE:  mem: platform fd map:  4096 bytes
        [2017/03/16 18:35:09:7206] NOTICE:  mem: per-conn:          308 bytes + protocol rx buf
        [2017/03/16 18:35:09:7207] NOTICE:  canonical_hostname = zengjf
        [2017/03/16 18:35:09:7207] NOTICE:  Compiled with OpenSSL support
        [2017/03/16 18:35:09:7208] NOTICE:  Using non-SSL mode
        [2017/03/16 18:35:09:7309] NOTICE:  OpenSSL doesn't support ECDH
        [2017/03/16 18:35:09:7311] NOTICE:  Listening on port 9000
        starting server with thread: 1...

    2. Browser error message:
        VM900:37 WebSocket connection to 'ws://localhost:9000/' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED

二、解决办法:
    1. cat package/libwebsockets/libwebsockets.mk
        ...
        LIBWEBSOCKETS_CONF_OPTS = -DLWS_WITHOUT_TESTAPPS=ON -DLWS_IPV6=OFF -DLWS_SSL_SERVER_WITH_ECDH_CERT=ON
        ...

    2. cat output/build/libwebsockets-v1.7.5/CMakeLists.txt
        ...
        if (LWS_SSL_SERVER_WITH_ECDH_CERT)
            set(LWS_SSL_SERVER_WITH_ECDH_CERT 1)
        endif()
        ...

    3. 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
        ...

 

posted on 2017-06-28 19:04  zengjf  阅读(897)  评论(0编辑  收藏  举报

导航