| Dart Home | PowerTCP FTP for .NET | Custom Development | Reply | PowerTCP FTP for .NET Topics | Forums |
| Author | Forum: PowerTCP FTP for .NET Topic: Timeout only works if it's less than 30 seconds |
| Brian From: Herzliya, Israel Posts: 7 Member Since: 02/20/03 |
posted February 20, 2003 11:48 AM I want to Put and Get files to a site which is very slow. When I set the Timeout property to 120000 (2 minutes) it makes no difference it times out after 30 seconds. If I set it to 5 seconds it times out after 5 seconds. Question no 2. Having just bought the damn thing I still have 29 out of 30 days free email support. What's the email address? |
Tony Priest![]() From: Utica, NY USA Posts: 8466 Member Since: 04/11/00 |
posted February 20, 2003 12:27 PM The address is support@dart.com and we received the letter that you already sent. I will disregard that letter and answer here if that's OK with you: Please tell me exactly how to duplicate the problem you are seeing. Use one of our samples and provide a site and other info if possible. |
| Brian From: Herzliya, Israel Posts: 7 Member Since: 02/20/03 |
posted February 20, 2003 12:37 PM The site I want to Get and Put from/to is from a business partner and is protected by a username and password which I'm obviously not prepared to post in a public forum. |
Tony Priest![]() From: Utica, NY USA Posts: 8466 Member Since: 04/11/00 |
posted February 20, 2003 12:42 PM Are you sure that you are getting a timeout error? Maybe the connection is actually closing, in which case we would not wait until the timeout period expired. I'll try to simualate what you are seeing here, but if I am not able to it will be up to you to provide a scenario to us that fails. If it comes to that you can reach us via email at support@dart.com |
| Brian From: Herzliya, Israel Posts: 7 Member Since: 02/20/03 |
posted February 20, 2003 12:56 PM Note that if I do this manually using a free FTP Ui type program which lets me set the timeout value to 120 seconds then I can get and put successfully every time. The reported exception is not a socket exception but it certainly looks like a timeout of some sort. Here is the code modified to remove partner details: Sub Main() Dim lsFileName As String = "SomeFileName" Dim lsData As String Try ReadFile(lsData, lsFileName) Catch e As Exception Console.WriteLine(e.Message) End Try Console.WriteLine("Data is: " & vbCrLf & lsData) Console.WriteLine("Press enter to continue") Console.ReadLine() End Sub Sub ReadFile(ByRef psData As String, ByVal psFileName As String) Dim ms As New MemoryStream() Dim dtTime As DateTime Dim Ftp2 As New Dart.PowerTCP.Ftp.Ftp() Ftp2.Timeout = 120000 Ftp2.Passive = True Ftp2.Server = "SomeIPAddress" Ftp2.Username = "SomeUserName" Ftp2.Password = "SomePassword" Ftp2.Invoke(FtpCommand.ChangeDir, "/SomeSubdirectory") Try dtTime = Now Ftp2.Get(psFileName, ms) Catch ex As System.Net.Sockets.SocketException Console.WriteLine(Now.Subtract(dtTime).ToString) Console.WriteLine("A socket exception has occurred: " + ex.Message) End Try Dim lbData(ms.Length) As Byte ' Attempt to read from stream ms.Position = 0 ms.Read(lbData, 0, ms.Length) psData = System.Text.Encoding.ASCII.GetString(lbData) End Sub Console Output: 00:00:28.9530759 A socket exception has occurred: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond |
| Brian From: Herzliya, Israel Posts: 7 Member Since: 02/20/03 |
posted February 20, 2003 12:58 PM Actually what I just wrote about it not being a Socket exception is nonsense. The exception I catch is: System.Net.Sockets.SocketException |
Tony Priest![]() From: Utica, NY USA Posts: 8466 Member Since: 04/11/00 |
posted February 20, 2003 1:14 PM I just used the FtpListView sample with the shipping Dart.PowerTCP.Ftp.dll (version 2.0.3.0) to connect to an FTP server with timeout set to 120 (this becomes 120000 later in the code) After the transfer started, I put a breakpoint in the Ftpserver so that it would remain connected but stop sending. As expected, after 2 minutes I recieved a timeout error. This tells me that timeout is working correctly. If you are using a different version of the control, please get the latest product from our website and install it (you'll need to uninstall the one on your system first). If you are using the same one I used, we are at the point where you'll have to provide us with duplication steps. |
| Brian From: Herzliya, Israel Posts: 7 Member Since: 02/20/03 |
posted February 20, 2003 1:27 PM Erm, Tony, are you trying to tell me that the code I supplied doesn't count as "duplication steps"? Let me just see if I understand. I post some code which has the problem. You try some completely different code which doesn't exhibit the problem and somehow I, a paying customer (or at least my boss is a paying customer), am supposed to be happy with that? |
Tony Priest![]() From: Utica, NY USA Posts: 8466 Member Since: 04/11/00 |
posted February 20, 2003 1:39 PM Since we already provide a sample that has the functionality built in, and that works, there is no need to look at your code (that would be code analysis, which is not part of the forum or introductory support). Please try the existing sample and see if you get the error to occur. If that is not an option for you, we offer several other support levels that offer code analysis. |
| Brian From: Herzliya, Israel Posts: 7 Member Since: 02/20/03 |
posted February 20, 2003 2:15 PM Tony, OK I wasted my time running our partner's details through your code sample. I took a stopwatch, hit start when I pressed OK on the login screen and pressed stop when I got this message: "A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond" Time? Well, what a surprise : 25 seconds. It's not working, buddy. By the way, I downloaded CoffeeCup Free FTP and tried the same thing. It worked. Many years ago I knew somebody who had a great expression for that free FTP program - "It worked like a bought one". Well, actually it didn't "work like a bought one" because the bought one failed and the free one worked. |
Tony Priest![]() From: Utica, NY USA Posts: 8466 Member Since: 04/11/00 |
posted February 20, 2003 2:21 PM You never stated which version you were using. As I stated above, I have version 2.0.3.0 and it works fine. Please verify that's what you have. If that's what you have, then I have to assume it has something to do with the server, so I'll need that information sent via email ASAP. If you can't send the private info, try to find a public server that has the same problem. |
Tony Priest![]() From: Utica, NY USA Posts: 8466 Member Since: 04/11/00 |
posted February 20, 2003 3:24 PM I got the information you sent via email, and I have an answer for you. The server you are using is behind a firewall and is not properly translating the PASV response. In other words the port it is telling us to connect to is an internal address (192.168.x.x). This makes it impossible for clients outside the firewall to do data transfers. The reason CoffeeCup works is probably because they default to non-Passive transfers while we default to passive. If you set Ftp2.Passive to false it will work. Please note that even after you login you will still have to get the file information from the listing manually because this is not a standard UNIX/DOS listing style. I'll recommend that the timeout be applied to the data connection initial connection time, but you need to be aware that it would not have helped you in this case. Since the server is giving an invalid IP, you could wait all day and it would never connect. |
| Brian From: Herzliya, Israel Posts: 7 Member Since: 02/20/03 |
posted February 21, 2003 6:06 AM Many thanks, Tony. That worked just great. Sorry if I was a bit rude earlier. I'm still a bit puzzled as to why setting Passive = False should fix firewall problems. I always thought it was the opposite way round, but my confusion matters far less than getting the damn thing working. |
Tony Priest![]() From: Utica, NY USA Posts: 8466 Member Since: 04/11/00 |
posted February 21, 2003 9:14 AM That's for when the Client is behind the firewall. If the server is behind the firewall and the firewall does NAT translation, it is supposed to replace the internal IP in the repsonse with the translated IP before it sends the response to the client. In your case, the server doesn't do this, so PASV can't be used. The reason CoffeeCup works is that they appear to ignore the IP address that is sent in the passive response and connect to whatever IP they originally connected to. No other client I tested against your server worked in PASV mode except CoffeeCup. We may consider adding a property that allows our control to do the same thing as CoffeeCup, but I can't commit to that at this time. |
| Reply | PowerTCP FTP for .NET Topics | Forums |
This site is powered by
PowerTCP WebServer for ActiveX
|