0 Replies Latest reply on Oct 8, 2018 10:01 PM by VinhNguyenThanh

    WebSocket Connection Failed from Android Application to WICED device Server

    VinhNguyenThanh

      Dear Sir,

      Could you help me to check this error when connection websocket using Websocket Server Example on WICED 6.1.2

      I just test some application on Windows Client Socket, and the application is okay, it can connect in both ws and wss(tls 1.1).

      But when i write it on android application, it can just connect to ws, the feature wss (tls 1.2) can not work. (The android application i try on echo.websocket.org still okay in both mode ws and wss)

      The Debug Log i got on WICED device:

      Initialising NetX_Duo v5.10_sp3
      Creating Packet pools
      WLAN MAC Address : 00:25:CA:11:51:97
      WLAN Firmware    : wl0: Apr 30 2018 04:14:19 version 7.45.98.50 (r688715 CY) FWID 01-283fcdb9
      WLAN CLM         : API: 12.2 Data: 9.10.39 Compiler: 1.29.4 ClmImport: 1.36.3 Creation: 2018-04-11 22:31:21
      IPv4 network ready IP: 192.168.0.1
      Setting IPv6 link-local address
      IPv6 network ready IP: FE80:0000:0000:0000:0225:CAFF:FE11:5197
      [App] Network initialized
      [App] Read the certificate Key from DCT
      Websocket Server console start
      > start
      [App] WebSocket Server running(listening...)
      >   . Setting up the SSL/TLS structure...
      TLS library asked for [5] bytes
      Received new TCP packet with length [157]
      TLS library asked for [152] bytes
      Skip [5] no of bytes from TCP received packet with length : [157]
      TLS library asked for [5] bytes
      Received new TCP packet with length [7]
      TLS library asked for [2] bytes
      Skip [5] no of bytes from TCP received packet with length : [7]
      WICED/security/BESL/mbedtls_open/library/ssl_tls.c:4219: is a fatal alert message (msg 46)
      WICED/security/BESL/mbedtls_open/library/ssl_tls.c:3837: mbedtls_ssl_read_record_layer() returned -30592 (-0x7780)
      WICED/security/BESL/mbedtls_open/library/ssl_srv.c:3859: mbedtls_ssl_read_record() returned -30592 (-0x7780)
      failed
        ! mbedtls_ssl_handshake returned -0xffff8880
      [websocket_server_deferred_connect_callback] Failed to accept socket - res:4 @websock: 0x2000ecd0 @sock: 0x2001457c
      [App] Error[11] @websocket:0x2000ecd0
      disconnect callback @websocket: 0x2000ecd0 @sock: 0x2001457c
        . Setting up the SSL/TLS structure...
      TLS library asked for [5] bytes
      Received new TCP packet with length [157]
      TLS library asked for [152] bytes
      Skip [5] no of bytes from TCP received packet with length : [157]
      TLS library asked for [5] bytes
      Received new TCP packet with length [7]
      TLS library asked for [2] bytes
      Skip [5] no of bytes from TCP received packet with length : [7]
      WICED/security/BESL/mbedtls_open/library/ssl_tls.c:4219: is a fatal alert message (msg 46)
      WICED/security/BESL/mbedtls_open/library/ssl_tls.c:3837: mbedtls_ssl_read_record_layer() returned -30592 (-0x7780)
      WICED/security/BESL/mbedtls_open/library/ssl_srv.c:3859: mbedtls_ssl_read_record() returned -30592 (-0x7780)
      failed
        ! mbedtls_ssl_handshake returned -0xffff8880
      [websocket_server_deferred_connect_callback] Failed to accept socket - res:4 @websock: 0x2000ef7c @sock: 0x20015344
      [App] Error[11] @websocket:0x2000ef7c
      disconnect callback @websocket: 0x2000ef7c @sock: 0x20015344
      

      And on Wireshark side, i got this information:

      websocket handshake.PNG

      Please check it for me what i do wrong.

      Thank you