Post a reply

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

martin

K_G wrote:

it you set reconectime = 1

then it tried once and fails

So this works for me.


Setting to 0, it never exits the loop

Thanks for posting this. Your are actually right. Sorry for misleading you.
K_G

it you set reconectime = 1

then it tried once and fails

So this works for me.


Setting to 0, it never exits the loop
martin

martin wrote:

session.ReconnectTime = TimeSpan.Zero;


Please attach the complete log.
martin

session.ReconnectTime = TimeSpan.Zero;
K_G

it keeps repeating this in the log


. Looking up host "REMOVED"
. Connecting to REMOVED port xxxx
. Failed to connect to REMOVED: Network error: No route to host
. Connection was lost, asking what to do.
. Asking user:
. Network error: No route to host "REMOVED". ()
< Script: Network error: No route to host "REMOVED".
< Script: Searching for host...
. Looking up host "REMOVED"


so how do i set the reconnecttime to 0, maybe that what im doing wrong form .net c sharp
martin

Can you attach a complete log showing how it tries for connect indefinitely, even if you set the Session.ReconnectTime to zero?
K_G

martin wrote:

With SCP protocol reconnect is not supported at all. That's why it does not reconnect.
With SFTP protocol you have to turn it off explicitly, if you do not want it. Set Session.ReconnectTime to zero to turn of reconnect completely.


This does not seem to work , as it still try's to reconnect, to the server


tried version 5.5.6 and latest version


Any more pointers??
K_G

martin wrote:

With SCP protocol reconnect is not supported at all. That's why it does not reconnect.
With SFTP protocol you have to turn it off explicitly, if you do not want it. Set Session.ReconnectTime to zero to turn of reconnect completely.


Im still unable to get it to STOP trying to reconnect when using SFTP

When using the WinSCP GUI i see a box appear seeing "Host is not communcation for more then 15 seconds"

giving me the option to Abort.

Then a box to Abort user, and the connection.

Looking at the log file for my C sharp code.


i see this is the log it seems to stick in a loop forever going around Looking up host "REMOVED"

What setting do I need to pass to make it abort if it fails, and not to retry.


log below.


Binary transfer mode selected.
. Checking existence of partially transfered file.
. Opening remote file.
> Type: SSH_FXP_OPEN, Size: 45, Number: 16899
< Type: SSH_FXP_HANDLE, Size: 13, Number: 16899
> Type: SSH_FXP_FSTAT, Size: 13, Number: 17160
< Type: SSH_FXP_ATTRS, Size: 37, Number: 17160
> Type: SSH_FXP_READ, Size: 25, Number: 17413
. Waiting for data timed out, asking user what to do.
. Asking user:
. **Host is not communicating for 15 seconds.
.
. Wait for another 15 seconds?** ()
< Script: Host is not communicating for more than 15 seconds.
< Still waiting...
< Note: If the problem repeats, try turning off 'Optimize connection buffer size'.
< Warning: Aborting this operation will close connection!
. Attempt to close connection due to fatal exception:
* **Terminated by user.**
. Closing connection.
. Sending special code: 12
. Sent EOF message
. Connection was lost, asking what to do.
. Asking user:
. Terminated by user. ()
< Script: Terminated by user.
< Script: Searching for host...

. Looking up host "REMOVED"
. Connecting to REMOVED port xxxx
. Failed to connect to REMOVED: Network error: No route to host
. Connection was lost, asking what to do.
. Asking user:
. Network error: No route to host "REMOVED". ()
< Script: Network error: No route to host "REMOVED".
< Script: Searching for host...
. Looking up host "REMOVED"
K_G

martin wrote:

With SCP protocol reconnect is not supported at all. That's why it does not reconnect.
With SFTP protocol you have to turn it off explicitly, if you do not want it. Set Session.ReconnectTime to zero to turn of reconnect completely.


How do i shorten the timeout when the link broken.

It seems to default to 2 mins apx.

Also the part downloaded file (filename.filepart) seems to be deleted, is there a way to stop this?
K_G

Ok, i will try that now , and see if works

Will update after
martin

With SCP protocol reconnect is not supported at all. That's why it does not reconnect.
With SFTP protocol you have to limit the reconnect time explicitly, if you do not want it. Set Session.ReconnectTime to low value (like 1 second) to limit the reconnect.
K_G

Thank you I will try this now.

as I say in SCP, when the link drops the file fails, so can trap it, this is good for me.

But in SFTP, it waits for the server to come back for ever, to carry on.

How do I get it to give up, like it does on scp.

Basicly is do not want it to reconnect, just fail, so i can check for the server and file later.

K
K_G

SFTP issue when downloading files

HI

can anyone help

im using the .net with c sharp.

When using SCP (works)

i can transfer a file no problem from a host.

If I break the link while downloading the file , the transfer stops as i hope it should, part way though.


Good


BUT

When using SFTP

When the file is transferring and i break the connection to test as above, (it does not fail), it seems to stick in transfer, and seems to me
to try and reconnect for ever, trying to get the file.

As if the server comes back , it carries on downloading.

How can I get it to timeout, ie the link to the server goes down, to fail like in SCP, so I can try again later, and not hang trying to recover on that one file.

I guess i have a setting missing

I need to be able to use SFTP to download from a server, but if the transfer stops part way, it need to drop the link, and then carry on next time, not as it seems to at the moment, wait for ever to carry on that file.


K