Skip to main content
Visitor II
August 23, 2024
Question

Failed to receive file via tftp

  • August 23, 2024
  • 2 replies
  • 1751 views

I am working on a tftp client program that receives a file from a tftp server.

I found the tftp client library below and ported it.

https://github.com/particle-iot/lwip/blob/master/contrib/examples/tftp/tftp_example.c

 

The file is received in debugging mode, but it is not received at runtime.

I checked and confirmed that 'fopen' does not work at runtime. I don't know why.

Below is the fopen code. 

-------------------------------------------------------------------------------------

static void *
tftp_open_file(const char* fname, u8_t is_write)
{
snprintf(full_filename, sizeof(full_filename), "%s%s", LWIP_TFTP_EXAMPLE_BASE_DIR, fname);
full_filename[sizeof(full_filename)-1] = 0;

if (is_write) {
return (void*)fopen(full_filename, "wb");
} else {
return (void*)fopen(full_filename, "rb");
}
}

-------------------------------------------------------------------------------------

I tried delaying before the tftp_client_init() function because it seemed to be a timing issue.

Please help.

 

    This topic has been closed for replies.

    2 replies

    Super User
    August 23, 2024

    Do you know why fopen works in debug mode? Do you use semihosting? 

     

    jmyooAuthor
    Visitor II
    August 26, 2024

    I don't know

    Please let me know

    Technical Moderator
    August 23, 2024

    Hello @jmyoo ,

    Ensure that the tftp configuration parameters are correctly set and the tftp server software is up to date and properly configured.