Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
4.2k views
in .NET FTP by (780 points)
I'm using edtFTPnetPRO version 5.0.2. Using a SecureFTPConnection, I set the Timeout to 5000. I have a device on my network that has a bogus IP address that isn't valid for my network (the user has to assign it a valid address through my program once I determine that it needs one). For example, I have a network of 192.168.11.xxx and the device has an address of 192.168.70.50. If I call Connect to that address it takes 20-25 seconds before it times out. What gives? Why doesn't it time out after 5 seconds?

4 Answers

0 votes
by (161k points)
Currently the timeout value does not apply to the Connect() method as the standard connect methods of Socket don't use a timeout.

We do plan to implement this soon via an asynchronous connect.
0 votes
by (780 points)
I currently use the synchronous Connect method, and catch exceptions that occur, like if the password I'm using is invalid. So if I want the connection attempt to timeout, could I do an asynchronous attempt with BeginConnect and do my own timeout with something like a WaitOne? And you don't HAVE to use a callback method, correct? I currently do something similar with TCP socket connections. For Example:

ar = myFTP.BeginConnect(Nothing, Nothing)
ConnectResult = ar.AsyncWaitHandle.WaitOne(Timeout, False)

If (ConnectResult) Then
      myFTP.EndConnect(ar)
Else
      myFTP.AbortAsynchronous(True)
End If


Would this work? And in this case, when would exceptions be thrown? On the EndConnect?
0 votes
by (161k points)
I haven't had a chance to try this, but that's how I'd do it for sockets and it should also work for the component.
0 votes
by (780 points)
Thanks. I've give it a shot.

Categories

...