远程登录功能的例程运行后,您可以在设备端查看相关日志。

前提条件

已配置并运行C Link SDK的远程登录的例程

设备端日志

  • 连接日志:

    [1631513133.788][LK-0313] MQTT user calls aiot_mqtt_connect api, connect
    [1631513133.788][LK-0317] LightSwitch&a18wP******
    [1631513133.788][LK-0318] 8B6DE4C174E205DCA3084C3D1C325E6CF580C1442F2F4EA516307486C78******
    establish tcp connection with server(host='iot-06******.mqtt.iothub.aliyuncs.com', port=[443])
    success to establish tcp, fd=3
    local port: 50612
    [1631513133.844][LK-1000] establish mbedtls connection with server(host='iot-06******.mqtt.iothub.aliyuncs.com', port=[443])
    [1631513133.922][LK-1000] success to establish mbedtls connection, (cost 44947 bytes in total, max used 47859 bytes)
    [1631513133.922][LK-0319] a18wP******.LightSwitch|timestamp=2524608000000,_ss=1,_v=sdk-c-4.1.0,securemode=2,signmethod=hmacsha256,ext=3,_conn=tls_8e,cid=1|
    [1631513133.977][LK-0313] MQTT connect success in 194 ms
    AIOT_MQTTEVT_CONNECT
  • 开启远程登录日志:

    以下日志显示:设备通知物联网平台,设备端远程登录已开启。
    [1631513133.977][LK-0317] cid[1] connected, online channel 1
    [1631513133.977][LK-0309] sub: /sys/a18wP******/LightSwitch/secure_tunnel/notify
    [1631513133.977][LK-1C00] remote proxy thread start!
     heartbeat response
    suback, res: -0x0000, packet id: 1, max qos: 1
  • 远程登录日志:

    设备开启远程登录后,在物联网平台控制台在线调试页面的远程登录页签下,您可以远程登录。更多信息,请参见远程登录

    以下日志显示:物联网平台已开启远程登录,且已在物联网平台远程登录了设备。
    [1631514265.011][LK-0309] pub: /sys/a18wP******/LightSwitch/secure_tunnel/notify
    
    [LK-030A] < 7B 22 73 63 68 65 6D 61  22 3A 22 77 73 73 22 2C | {"schema":"wss",
    [LK-030A] < 22 70 61 74 68 22 3A 22  2F 74 75 6E 6E 65 6C 2F | "path":"/tunnel/
    [LK-030A] < 63 32 62 62 34 38 38 64  2D 39 36 63 31 2D 34 38 | c2bb488d-96c1-48
    [LK-030A] < 64 31 2D 38 34 38 64 2D  33 32 64 63 36 35 38 64 | d1-848d-32dc658*
    [LK-030A] < 38 61 39 37 2F 64 65 73  74 22 2C 22 74 75 6E 6E | ****/dest","tunn
    [LK-030A] < 65 6C 5F 69 64 22 3A 22  63 32 62 62 34 38 38 64 | el_id":"c2bb488d
    [LK-030A] < 2D 39 36 63 31 2D 34 38  64 31 2D 38 34 38 64 2D | -96c1-48d1-848d-
    [LK-030A] < 33 32 64 63 36 35 38 64  38 61 39 37 22 2C 22 70 | 32dc658*****","p
    [LK-030A] < 61 79 6C 6F 61 64 5F 6D  6F 64 65 22 3A 22 61 70 | ayload_mode":"ap
    [LK-030A] < 70 2D 70 72 6F 78 79 22  2C 22 70 6F 72 74 22 3A | p-proxy","port":
    [LK-030A] < 34 34 33 2C 22 68 6F 73  74 22 3A 22 69 6F 74 2D | 443,"host":"iot-
    [LK-030A] < 73 65 63 75 72 65 2D 74  75 6E 6E 65 6C 2D 63 6E | secure-tunnel-cn
    [LK-030A] < 2D 73 68 2E 61 6C 69 79  75 6E 63 73 2E 63 6F 6D | -sh.aliyuncs.com
    [LK-030A] < 22 2C 22 6F 70 65 72 61  74 69 6F 6E 22 3A 22 63 | ","operation":"c
    [LK-030A] < 6F 6E 6E 65 63 74 22 2C  22 75 72 69 22 3A 22 77 | onnect","uri":"w
    [LK-030A] < 73 73 3A 2F 2F 69 6F 74  2D 73 65 63 75 72 65 2D | ss://iot-secure-
    [LK-030A] < 74 75 6E 6E 65 6C 2D 63  6E 2D 73 68 2E 61 6C 69 | tunnel-cn-sh.ali
    [LK-030A] < 79 75 6E 63 73 2E 63 6F  6D 2F 74 75 6E 6E 65 6C | yuncs.com/tunnel
    [LK-030A] < 2F 63 32 62 62 34 38 38  64 2D 39 36 63 31 2D 34 | /c2bb488d-96c1-4
    [LK-030A] < 38 64 31 2D 38 34 38 64  2D 33 32 64 63 36 35 38 | 8d1-848d-32dc658
    [LK-030A] < 64 38 61 39 37 2F 64 65  73 74 22 2C 22 74 6F 6B | *****/dest","tok
    [LK-030A] < 65 6E 22 3A 22 31 64 32  31 34 35 63 33 2D 64 38 | en":"1d2145c3-d8
    [LK-030A] < 39 30 2D 34 37 64 38 2D  62 30 36 34 2D 36 35 62 | 90-47d8-b064-65b
    [LK-030A] < 33 66 38 62 35 65 64 32  38 22 7D                | 3f8******"}
    
    [1631514265.011][LK-1C00] _switch_topic_handler payload:{"schema":"wss","path":"/tunnel/c2bb488d-96c1-48d1-848d-32dc658*****/dest","tunnel_id":"c2bb488d-96c1-48d1-848d-32dc658*****","payload_mode":"app-proxy","port":443,"host":"iot-secure-t
    ra_event_cb AIOT_RA_EVT_OPEN_WEBSOCKET c2bb488d-96c1-48d1-848d-32dc658*****h
    [1631514265.233][LK-1C00] start to create cloud channel
    [1631514265.233][LK-1C00] connect remote service host iot-secure-tunnel-cn-sh.aliyuncs.com, port 443success to establish tcp, fd=4
    local port: 55048
    [1631514265.266][LK-1000] establish mbedtls connection with server(host='iot-secure-tunnel-cn-sh.aliyuncs.com', port=[443])
    [1631514265.322][LK-1000] success to establish mbedtls connection, (cost 55298 bytes in total, max used 57986 bytes)
    [1631514265.355][LK-0F10] open_cloud_proxy_channel success
    [1631514265.355][LK-1C00] websocket c2bb488d-96c1-48d1-848d-32dc658***** opened
    ra_event_cb AIOT_RA_EVT_CONNECT c2bb488d-96c1-48d1-848d-32dc658*****h
    local 127.0.0.1, 22
    success to establish tcp, fd=5
    local port: 45048
    [1631514276.722][LK-1C00] reponse payload:{"code":0,"msg":"new session response"}
    [1631514276.722][LK-1C00] reponse header:{"frame_type":1,"frame_id":4834,"service_type":"_SSH","session_id":"1631514276******"}[1631514277.166][LK-1C00] release the session: 1631514276******
    [1631514277.166][LK-1000] adapter_network_deinit
    [1631514277.166][LK-1C00] reponse payload:{"code":0,"msg":"release session response"}
    local 127.0.0.1, 22
    success to establish tcp, fd=5
    local port: 45050
    [1631514280.155][LK-1C00] reponse payload:{"code":0,"msg":"new session response"}
    [1631514280.155][LK-1C00] reponse header:{"frame_type":1,"frame_id":3127,"service_type":"_SSH","session_id":"1631514280152725"}heartbeat response
    [1631514285.366][LK-1C00] websocket c2bb488d-96c1-48d1-848d-32dc658***** ping
    [1631514285.388][LK-1C00] websocket c2bb488d-96c1-48d1-848d-32dc658***** pong

后续步骤

运行日志中出现的错误信息,请参见aiot_ra_api.h中的状态码描述根据提示解决问题。若未能解决问题,您可以提交工单