download demo can't work

Hi

    I'm testing downloading a file from AWS S3 using ncs but it's not working well. I'm getting an error called -116 Connection timed out. 
    I also used another client to connect and it was not able to connect. I used the IP and port from the logs.

    Can you give me some advice, thanks.

ncs: ncs2.7.0
sample: v2.7.0\nrf\samples\net\download    only build and download

board: nRF7002-DK

log

error position

Parents
  • Hi,

     

    Q1: Is this issue repeatable on your side, or is the sample itself unstable?

    Q2: Could you try to disable ipv6 to see if this issue still exists? this is done by setting CONFIG_NET_IPV6=n and compile/flash again.

    Q3: Have you checked that you can access this specific website on your network in general? Ie. that it is not a firewall that is blocking the connection?

     

    Kind regards,

    Håkon

Reply
  • Hi,

     

    Q1: Is this issue repeatable on your side, or is the sample itself unstable?

    Q2: Could you try to disable ipv6 to see if this issue still exists? this is done by setting CONFIG_NET_IPV6=n and compile/flash again.

    Q3: Have you checked that you can access this specific website on your network in general? Ie. that it is not a firewall that is blocking the connection?

     

    Kind regards,

    Håkon

Children
  • Q1: Is this issue repeatable on your side, or is the sample itself unstable?

    Yes,this issue repeatable on my side 100%

    Q2: Could you try to disable ipv6 to see if this issue still exists? this is done by setting CONFIG_NET_IPV6=n and compile/flash again.

    OK, I will do it.

    Q3: Have you checked that you can access this specific website on your network in general? Ie. that it is not a firewall that is blocking the connection?

    I can open it.

  • Q2: Could you try to disable ipv6 to see if this issue still exists? this is done by setting CONFIG_NET_IPV6=n and compile/flash again.

    It also can't work,Do I need to renew my certificate?

  • Hi,

     

    The certificate shall be loaded upon boot.

    For debugging purposes, could you try to add a couple of seconds delay in this line?

    https://github.com/nrfconnect/sdk-nrf/blob/main/samples/net/download/src/main.c#L304

     

    ie. a k_msleep(5000); for instance, before the download starts.

     

    Kind regards,

    Håkon

  • Hi,

      Thanks for your response. I tried your method, but it didn't work.

      I personally feel like there is something wrong with the configuration, because there is no problem using our URL. So I think something like certificate or user name password need config. 

      Can you try this example? I believe you will also be able to reproduce the problem. Thanks.

    URL: https://minewsemi-s3-test.s3.amazonaws.com/1.png

  • Hi,

     

    That is also using the amazon root CA, so there should not be a problem with the certificate chain.

    This worked on my end (please note: I have no ipv6 connectivity at my end):

    *** Using Zephyr OS v3.6.99-100befc70c74 ***
    Download client sample started
    Provisioning certificate
    CA certificate already exists, sec tag: 42
    Connecting to network
    [00:00:02.193,176] <inf> wifi_mgmt_ext: Connection requested
    IP Up
    Network connected
    [00:00:10.297,882] <dbg> download_client: set_state: state = 1
    [00:00:10.297,912] <inf> download_client: Downloading: https://minewsemi-s3-test.s3.amazonaws.com/1.png [0]
    Downloading https://minewsemi-s3-test.s3.amazonaws.com/1.png
    [00:00:10.298,309] <dbg> download_client: client_connect: Port not specified, using default: 443
    [00:00:10.298,431] <dbg> download_client: host_lookup: Failed to resolve hostname minewsemi-s3-test.s3.amazonaws.com on IPv6
    [00:00:10.369,781] <dbg> download_client: client_socket_connect: family: 1, type: 1, proto: 258
    [00:00:10.370,483] <inf> download_client: Setting up TLS credentials, sec tag count 1
    [00:00:10.370,574] <inf> download_client: Connecting to 52.217.235.201
    [00:00:10.370,605] <dbg> download_client: client_socket_connect: fd 14, addrlen 8, fam IPv4, port 443
    [00:00:12.954,345] <dbg> download_client: set_state: state = 2
    [00:00:12.954,498] <dbg> download_client: http_get_request_send: HTTP request
                                              47 45 54 20 2f 31 2e 70  6e 67 20 48 54 54 50 2f |GET /1.p ng HTTP/
                                              31 2e 31 0d 0a 48 6f 73  74 3a 20 6d 69 6e 65 77 |1.1..Hos t: minew
                                              73 65 6d 69 2d 73 33 2d  74 65 73 74 2e 73 33 2e |semi-s3- test.s3.
                                              61 6d 61 7a 6f 6e 61 77  73 2e 63 6f 6d 0d 0a 52 |amazonaw s.com..R
                                              61 6e 67 65 3a 20 62 79  74 65 73 3d 30 2d 34 30 |ange: by tes=0-40
                                              39 35 0d 0a 43 6f 6e 6e  65 63 74 69 6f 6e 3a 20 |95..Conn ection: 
                                              6b 65 65 70 2d 61 6c 69  76 65 0d 0a 0d 0a       |keep-ali ve....  
    [00:00:12.956,024] <dbg> download_client: download_thread: Receiving up to 4096 bytes at 0x2000cc34...
    [00:00:13.146,789] <dbg> download_client: handle_received: Read 439 bytes from socket
    [00:00:13.146,911] <dbg> download_client: http_header_parse: GET header size: 439
    --- 1 messages dropped ---
    [00:00:13.147,155] <dbg> download_client: http_header_parse: File size = 966
    [00:00:13.147,705] <dbg> download_client: download_thread: Receiving up to 4096 bytes at 0x2000cc34...
    [00:00:13.153,228] <dbg> download_client: handle_received: Read 966 bytes from socket
    [00:00:13.153,259] <inf> download_client: Downloaded 966/966 bytes (100%)
    [ 100% ] |==================================================| (966/966 bytes)[00:00:13.153,869] <inf> download_client: Download complete
    
    Download completed in 2856 ms @ 338 bytes per sec, total 966 bytes
    Bye
    [00:00:13.168,304] <dbg> download_client: set_state: state = 4
    [00:00:13.174,468] <dbg> download_client: set_state: state = 0
    Socket closed
    [00:00:13.174,499] <dbg> download_client: download_thread: Connection closed
    IP down
    Disconnected from network
    

     

    Kind regards,

    Håkon

Related