<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Callback issue in the FTP get function of 9160</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/112664/callback-issue-in-the-ftp-get-function-of-9160</link><description>How to determine if the download is complete when downloading files from the FTP server using the ftp_get function? 
 Although Ctrl_cb will return code, in my actual testing, when downloading a large file, the download was not completed yet, and Ctrl_cb</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 12 Jul 2024 15:38:29 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/112664/callback-issue-in-the-ftp-get-function-of-9160" /><item><title>RE: Callback issue in the FTP get function of 9160</title><link>https://devzone.nordicsemi.com/thread/493684?ContentTypeID=1</link><pubDate>Fri, 12 Jul 2024 15:38:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:dceb97db-c66a-4994-8d61-e7b17d108776</guid><dc:creator>dejans</dc:creator><description>&lt;p&gt;Hi,&lt;br /&gt;&lt;br /&gt;We will look into this internally for possible improvement.&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Dejan&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Callback issue in the FTP get function of 9160</title><link>https://devzone.nordicsemi.com/thread/493683?ContentTypeID=1</link><pubDate>Fri, 12 Jul 2024 15:29:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0d55f710-0882-4c7b-aa8c-1e6a179e2cc3</guid><dc:creator>dejans</dc:creator><description>&lt;p&gt;Hi,&lt;br /&gt;&lt;br /&gt;Thank you for providing the update.&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Dejan&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Callback issue in the FTP get function of 9160</title><link>https://devzone.nordicsemi.com/thread/493300?ContentTypeID=1</link><pubDate>Thu, 11 Jul 2024 07:24:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8909ee76-f01e-4830-a481-677b711231ee</guid><dc:creator>llly</dc:creator><description>&lt;p&gt;Perhaps I should have been more detailed.&lt;br /&gt;&lt;br /&gt;The specific issue is that after calling ftp_get, the device should have created an FTP thread to download files. However, if the download time exceeds FTP_DATA_TIMEOUT_SEC, ftp_get returns a timeout code and exits. At this time, the FTP thread is not closed, but continues to run, so the callback function passed in ftp_init is still called.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Callback issue in the FTP get function of 9160</title><link>https://devzone.nordicsemi.com/thread/493275?ContentTypeID=1</link><pubDate>Thu, 11 Jul 2024 05:58:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:06d597b1-1523-47c2-ac0f-d0f37d082508</guid><dc:creator>llly</dc:creator><description>&lt;p&gt;Hi dejans&lt;/p&gt;
&lt;p&gt;I tested CONFIG_FTP_CLIENT_KEEPALIVE_TIME, but it didn&amp;#39;t work. Instead, I modified&amp;nbsp;&lt;span&gt;FTP_DATA_TIMEOUT_SEC&amp;nbsp;&lt;/span&gt;in ftp_client. c to solve this problem. It may not be the best solution, but currently it&amp;#39;s not a big problem. Simply put, the time for ftp_get cannot exceed&amp;nbsp;&lt;span&gt;FTP_DATA_TIMEOUT_SEC&lt;/span&gt;, otherwise it will return -116, with a default of 60 seconds. Therefore, I will change this value to a few minutes. Perhaps you can improve this place a bit? But for me, this problem has been solved.&lt;/p&gt;
&lt;p&gt;Anyway, thank you for your help.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Callback issue in the FTP get function of 9160</title><link>https://devzone.nordicsemi.com/thread/493095?ContentTypeID=1</link><pubDate>Wed, 10 Jul 2024 09:17:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:749187b7-7bd3-48da-a6cc-b3f97b905446</guid><dc:creator>dejans</dc:creator><description>&lt;p&gt;Hi,&lt;br /&gt;&lt;br /&gt;In the&amp;nbsp;&lt;a href="https://docs.nordicsemi.com/bundle/ncs-2.4.3/page/nrf/libraries/networking/ftp_client.html#lib-ftp-client"&gt;FTP client&lt;/a&gt;&amp;nbsp;library, there is&amp;nbsp;&lt;a href="https://docs.nordicsemi.com/bundle/ncs-2.4.3/page/kconfig/index.html#CONFIG_FTP_CLIENT_KEEPALIVE_TIME"&gt;CONFIG_FTP_CLIENT_KEEPALIVE_TIME&lt;/a&gt;&amp;nbsp;option which is by default set to 60 seconds. You could try either to increase this value or turn the KEEPALIVE option off by changing its value to 0.&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Dejan&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Callback issue in the FTP get function of 9160</title><link>https://devzone.nordicsemi.com/thread/492849?ContentTypeID=1</link><pubDate>Tue, 09 Jul 2024 03:50:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b9c4f890-a57e-40f1-99b1-17aac6c72bf5</guid><dc:creator>llly</dc:creator><description>&lt;p&gt;Hi dejans&lt;/p&gt;
&lt;p&gt;I am using our own FTP server.&lt;/p&gt;
&lt;p&gt;The current log does not display 226, only a -116 connection timeout code. When downloading a relatively small file, the 226 code can be returned normally when the download is completed, but when downloading a large file, I think it should be because the download time exceeded the timeout time, so he thought the command timed out, which ultimately led to a return of -116?&lt;/p&gt;
&lt;p&gt;In other words, when downloading a large file, after a period of time (about one or two minutes?), if the download is not completed yet, ftp_get will return a -116 timeout code. How can we make it return 226 only when the download is completed, instead of -116?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Callback issue in the FTP get function of 9160</title><link>https://devzone.nordicsemi.com/thread/492412?ContentTypeID=1</link><pubDate>Fri, 05 Jul 2024 10:16:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7b9f86a8-2f16-4c2b-8cc8-9b5b71dcf341</guid><dc:creator>dejans</dc:creator><description>&lt;p&gt;Hi,&lt;br /&gt;&lt;br /&gt;Documentation for SLM sample specifies that client behavior may vary depending on the server that is used for testing. Which FTP server did you use?&lt;br /&gt;&lt;br /&gt;You could try to test FTP connection using&amp;nbsp;&lt;a href="https://docs.nordicsemi.com/bundle/ncs-2.4.3/page/nrf/applications/serial_lte_modem/doc/slm_testing.html#ftp_at_commands"&gt;FTP AT commands&lt;/a&gt;.&lt;/p&gt;
[quote user="llly"]when I downloaded about one-third of the time, it gave me a notification that the download was completed[/quote]
&lt;p&gt;Where is this shown in the log?&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Dejan&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Callback issue in the FTP get function of 9160</title><link>https://devzone.nordicsemi.com/thread/492346?ContentTypeID=1</link><pubDate>Fri, 05 Jul 2024 02:59:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4cf097aa-4dca-4bf2-93de-1ce7d4ba79b1</guid><dc:creator>llly</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;dejans,&lt;/p&gt;
&lt;p&gt;I tested FTP using SLM, which includes FTP_client h, and there are no other special settings for FTP. Then, as in the previous reply, I wrote two callback functions. In the ctrl callback, I only printed out the received information. In the data callback, I added some logical code to display the downloaded data volume and save the received data to LFS.&lt;/p&gt;
&lt;p&gt;Then below is the log I obtained, and I have removed some duplicate parts for easy viewing&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;[10:37:57.976]收←◆ctrl_cb: 220 (vsFTPd 3.0.3)


[10:37:58.250]收←◆ctrl_cb: 200 Always in UTF8 mode.


[10:37:58.619]收←◆ctrl_cb: 331 Please specify the password.


[10:37:59.136]收←◆ctrl_cb: 230 Login successful.

lfs_dir_fetchmatch count: 4
return 0 

[10:37:59.416]收←◆ctrl_cb: 227 Entering Passive Mode (8,222,179,2,154,94)


[10:38:02.131]收←◆data len = 708
lfs_dir_fetchmatch count: 5
return 0 

[10:38:02.243]收←◆count: 1
data len = 708

[10:38:02.361]收←◆count: 2
data len = 708

[10:38:02.493]收←◆count: 3
data len = 708

[10:38:02.638]收←◆count: 4
data len = 708

[10:38:02.798]收←◆count: 5

[10:38:04.418]收←◆data len = 708

[10:38:04.685]收←◆count: 6
data len = 708

[10:38:04.793]收←◆count: 7
data len = 708

[10:38:04.918]收←◆count: 8
data len = 708

[10:38:05.017]收←◆ctrl_cb: 150 Opening BINARY mode data connection for /newdir/test2.bin (312643 bytes).


[10:38:05.068]收←◆count: 9

[10:38:06.165]收←◆data len = 708

[10:38:06.313]收←◆count: 10

[10:38:06.497]收←◆data len = 708

[10:38:06.659]收←◆count: 11

[10:38:06.784]收←◆data len = 632

[10:38:07.059]收←◆count: 12
data len = 708

[10:38:07.180]收←◆count: 13

[10:38:07.521]收←◆data len = 708

[10:38:07.648]收←◆count: 14
data len = 76

[10:38:07.775]收←◆count: 15

[10:38:08.642]收←◆data len = 708

                Omit the same part in the middle here

[10:39:04.092]收←◆count: 135

[10:39:04.485]收←◆data len = 708

[10:39:04.605]收←◆count: 136

[10:39:05.040]收←◆ftp_get return = -116
**********************************************mx_startTftp finish

Upgrade OK
OK

[10:39:05.108]收←◆data len = 708
FAIL: seek /lfs/test.bin: -9FAIL: write /lfs/test.bin: -9count: 137

[10:39:05.634]收←◆data len = 708
FAIL: seek /lfs/test.bin: -9FAIL: write /lfs/test.bin: -9count: 138

[10:39:05.955]收←◆data len = 708
FAIL: seek /lfs/test.bin: -9FAIL: write /lfs/test.bin: -9count: 139

[10:39:06.274]收←◆data len = 708
FAIL: seek /lfs/test.bin: -9FAIL: write /lfs/test.bin: -9count: 140

[10:39:06.564]收←◆data len = 708
FAIL: seek /lfs/test.bin: -9FAIL: write /lfs/test.bin: -9count: 141

[10:39:06.998]收←◆data len = 708
FAIL: seek /lfs/test.bin: -9FAIL: write /lfs/test.bin: -9count: 142

               Omit the same part in the middle here

[10:41:25.213]收←◆data len = 708
FAIL: seek /lfs/test.bin: -9FAIL: write /lfs/test.bin: -9count: 441

[10:41:25.500]收←◆data len = 708
FAIL: seek /lfs/test.bin: -9FAIL: write /lfs/test.bin: -9count: 442

[10:41:25.869]收←◆data len = 415
FAIL: seek /lfs/test.bin: -9FAIL: write /lfs/test.bin: -9count: 443
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;In the FTP data callback, I saved the downloaded data to LFS, but as you can see, when I downloaded about one-third of the time, it gave me a notification that the download was completed (usually returning a 226 code, this time it didn&amp;#39;t return, but this is not important, except for not displaying the 226 code, everything else is exactly the same), and then the LFS file closed, causing me to be unable to write data. And when the download is actually completed in the end, there is no return code or any information&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Callback issue in the FTP get function of 9160</title><link>https://devzone.nordicsemi.com/thread/492332?ContentTypeID=1</link><pubDate>Thu, 04 Jul 2024 19:29:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9b6ea404-e723-49c1-8b15-5cbb74932ab4</guid><dc:creator>dejans</dc:creator><description>&lt;p&gt;Hi,&lt;br /&gt;&lt;br /&gt;Could you provide more information about your setup?&lt;br /&gt;&lt;br /&gt;Do you have any log which you could share?&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Dejan&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Callback issue in the FTP get function of 9160</title><link>https://devzone.nordicsemi.com/thread/491942?ContentTypeID=1</link><pubDate>Wed, 03 Jul 2024 01:29:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2f9147ab-c797-4ccc-b310-486d8ba33001</guid><dc:creator>llly</dc:creator><description>&lt;p&gt;Hello Dejans&lt;/p&gt;
&lt;p&gt;Yes, I use SLM,the NCS version is 2.6.1&lt;/p&gt;
&lt;p&gt;Sorry, I forgot that these two function names were given by myself,data_cb and ctrl_cb are callback functions in the ftp_client library used to receive ftp information.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;typedef void (*ftp_client_callback_t)(const uint8_t *msg, uint16_t len);

ftp_client_callback_t ctrl_cb(const uint8_t *msg, uint16_t len);
ftp_client_callback_t data_cb(const uint8_t *msg, uint16_t len);
ftp_init(ctrl_cb, data_cb);&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;After starting the FTP connection, ctrl_cb will receive a message similar to &amp;quot;&amp;nbsp;230 Login successful.&amp;quot; indicating the current status,data_cb will receive data obtained from the FTP server, such as data from downloaded files.&lt;/p&gt;
&lt;p&gt;If you need any other information, please let me know, thanks&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Callback issue in the FTP get function of 9160</title><link>https://devzone.nordicsemi.com/thread/491823?ContentTypeID=1</link><pubDate>Tue, 02 Jul 2024 11:35:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d09c159c-883f-4006-886e-325c481d2a01</guid><dc:creator>dejans</dc:creator><description>&lt;p&gt;Hi,&lt;br /&gt;&lt;br /&gt;Is your application based on&amp;nbsp;&lt;a href="https://docs.nordicsemi.com/bundle/ncs-latest/page/nrf/applications/serial_lte_modem/README.html"&gt;serial_lte_modem&lt;/a&gt;? Can you provide more information about your application?&lt;br /&gt;&lt;br /&gt;Which NCS version do you use?&lt;br /&gt;&lt;br /&gt;What do you refer to as data_cb and ctrl_cb?&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Dejan&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Callback issue in the FTP get function of 9160</title><link>https://devzone.nordicsemi.com/thread/491797?ContentTypeID=1</link><pubDate>Tue, 02 Jul 2024 09:46:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4bfd699e-f0d7-4502-9a2f-a3a4f6b8e408</guid><dc:creator>llly</dc:creator><description>&lt;p&gt;&lt;span data-slate-fragment="JTVCJTdCJTIydHlwZSUyMiUzQSUyMnBhcmFncmFwaCUyMiUyQyUyMmNoaWxkcmVuJTIyJTNBJTVCJTdCJTIyaWQlMjIlM0ElMjJZWnFOT0tPWEFyJTIyJTJDJTIycGFyYUlkeCUyMiUzQTAlMkMlMjJzcmMlMjIlM0ElMjJBZGRpdGlvbmFsbHklMkMlMjBob3clMjBjYW4lMjB3ZSUyMGRldGVybWluZSUyMHdoaWNoJTIwRlRQJTIwZnVuY3Rpb24lMjB0cmlnZ2VyZWQlMjB0aGUlMjBjYWxsYmFjayUyMGVudHJ5JTIwaW4lMjBkYXRhX2NiJTIwYW5kJTIwY3RybF9jYiUzRiUyMENhbiUyMG9ubHklMjBkZXRlcm1pbmUlMjBieSUyMGN1c3RvbWl6aW5nJTIwYSUyMGdsb2JhbCUyMHZhcmlhYmxlJTJDJTIwc2V0dGluZyUyMHRoZSUyMHZhcmlhYmxlJTIwd2hlbiUyMGNhbGxpbmclMjB0aGUlMjBGVFAlMjBmdW5jdGlvbiUyQyUyMGFuZCUyMHRoZW4lMjByZWFkaW5nJTIwdGhlJTIwdmFyaWFibGUlMjBpbiUyMHRoZSUyMGNhbGxiYWNrJTNGJTIyJTJDJTIyZHN0JTIyJTNBJTIyJUU2JUFEJUE0JUU1JUE0JTk2JUVGJUJDJThDJUU2JTg4JTkxJUU0JUJCJUFDJUU1JUE2JTgyJUU0JUJEJTk1JUU3JUExJUFFJUU1JUFFJTlBJUU2JTk4JUFGJUU1JT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yMHRoZSUyMEZUUCUyMGZ1bmN0aW9uJTJDJTIwYW5kJTIwdGhlbiUyMHJlYWRpbmclMjB0aGUlMjB2YXJpYWJsZSUyMGluJTIwdGhlJTIwY2FsbGJhY2slM0YlMjIlN0QlNUQlN0QlNUQ="&gt;Additionally, how can we determine which FTP function triggered the callback entry in data_cb and ctrl_cb? Can only determine by customizing a global variable, setting the variable when calling the FTP function, and then reading the variable in the callback?&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>