2024-08-22 05:47 PM
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.