|
Hi, I try to connect to the sFTP server. May be it is too busy and I can connect to it only after ~30sec (using for example WinSCP client). But using Rebex on the 20th second I got timeout exception (see details below). Timeout property is not affect on it (it is set to the 300*1000). Thank you! Exception stacktrace:
|
|
This exception was thrown by .NET's Socket class as a result of an error reported by Winsock, Windows TCP subsystem. Winsock has its own timeout values and some of them (including Connect timeout) can't be affected by applications. If interested, check out the Winsock FAQ for more information – while it is possible for an application to make connection attempts fail sooner than TCP subsystem timeout occurs (and the FAQ describes how), it's not possible to make it wait longer. If the Connect method times out after 20 seconds, we can't change that. However, this should affect all applications including WinSCP. Perhaps WinSCP tries re-connecting after it gets this kind of error? You can reproduce that kind of behavior with Rebex SFTP as well - catch the SftpException thrown by the Connect method, check its Status or Inner Exceptions to make sure it's this error and try again if needed. But you can use non blocking Socket.BeginConnect method instead Socket.Connect. For example: http://stackoverflow.com/questions/1062035/how-to-config-socket-connect-timeout-in-c
(06 Oct '11, 15:18)
Maxim Shoshin
Unfortunately, non-blocking BeginConnect would time out as well. Even the example in the link discusses ways to make it time out sooner (which is possible, as I stated above), not ways to make it time out later. Try the following code:
(06 Oct '11, 15:32)
Lukas Pokorny ♦♦
|