curl-library
tftp fail during data transfer
Date: Tue, 15 Sep 2015 06:39:09 +0530
Hello Experts,
I'm facing problem in downloading a file via tftp using curl. I'm
using 7.33.0 version
and I have patched "#1310 TFTP connection takes CURLOPT_TIMEOUT
seconds to time out, not CURLOPT_CONNECTTIMEOUT" bug.
In the write callback routine, I send the received bytes to a remote
machine and wait maximum of 90secs for the acknowledgement to receive.
If the ack is received from the remote machine I return the size*nmemb
bytes for curl to fetch next bytes for transfer. If the ack is not
received from remote machine I return zero bytes causing curl to abort
the transfer with curl write error.
I had set CURLOPT_CONNECTTIMEOUT=10 and have tested below scenarios.
>.For unreachable tftp ip address, connection timeout happens after 10secs and curl returns return code = 28 Timeout was reached. Looks fine to me.
>.Initiated the tftp transfer and after few bytes of transfer I shut the remote server link, I do not receive the ack for byte transferred within 90sec and return zero.curl returned code=23.Failed writing received data to disk/application. Looks fine to me.
>.Initiated the tftp transfer and after few bytes of transfer I shut the tftp server link, curl did not return any error.I think it keeps waiting for data from tftp server. I think curl waits for default CURLOPT_TIMEOUT . Is there any way for me to timeout in the case where tftp link goes down in the middle of transfer and curl returns an error similar to connection timeout. I know CURLOPT_TIMEOUT sets the maximum time for allowing the request to complete.Suppose I set CURLOPT_TIMEOUT to 30secs, and suppose complete transfer takes around 20secs. If tftp link goes down at 10sec and comes back at 25sec,tftp data transfer resumes but due to CURLOPT_TIMEOUT set as 30secs the timeout is reached at 30sec and transfer will be incomplete.
Can you please help in resolving the above scenario?
-- Thanks Raghu SAVE TREES..GO GREEN ------------------------------------------------------------------- List admin: http://cool.haxx.se/list/listinfo/curl-library Etiquette: http://curl.haxx.se/mail/etiquette.htmlReceived on 2015-09-15