Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
6.8k views
in .NET FTP by
I'm demoing the Pro version and am having trouble with using the ActivePortRange feature of the Pro FTP Client object. I am setting it, but the Active port that is used is never within the range that I set. In all of my tests so far, it is just one port number higher than the outgoing control port. Any ideas? Am I missing something?

9 Answers

0 votes
by (162k points)
It should be in the range - how are you determining the port number that is set? You are using active and not passive mode I assume.

I'm demoing the Pro version and am having trouble with using the ActivePortRange feature of the Pro FTP Client object. I am setting it, but the Active port that is used is never within the range that I set. In all of my tests so far, it is just one port number higher than the outgoing control port. Any ideas? Am I missing something?
0 votes
by
It should be in the range - how are you determining the port number that is set? You are using active and not passive mode I assume.

I am using active mode. I am watching open ports using the windows netstat command. Passive mode works fine, and active mode works fine if I disable my firewall. I have a small port range opened up in my firewall (which is why I am setting the active port range), but it just will not use a port in the range that I specify. Is there a minimum number of ports that I have to allow?
0 votes
by (162k points)
Probably best to post a snippet of the log file (see the Dev Guide) and what port range you have set. That should tell us what is happening.

I am using active mode. I am watching open ports using the windows netstat command. Passive mode works fine, and active mode works fine if I disable my firewall. I have a small port range opened up in my firewall (which is why I am setting the active port range), but it just will not use a port in the range that I specify. Is there a minimum number of ports that I have to allow?
0 votes
by
Probably best to post a snippet of the log file (see the Dev Guide) and what port range you have set. That should tell us what is happening.

The port range that I am setting is 12000-13000. I have generated a log file as requested. The first line of the log is one that was generated manually immediately after I set the port range. That line specifies the port range by getting the info directly from the instance of the ProFTPClient that I set the range for in the line above it. This means that the range is being set properly in the object. Here is the log file output:
INFO [FTPConfig.MainForm] 6 Apr 2006 10:22:17.984 : ActivePortRange = 12000 - 13000
INFO [EnterpriseDT.Net.Ftp.Pro.ProFTPClient] 6 Apr 2006 10:22:18.000 : Licence expiry date: 4/24/2006
INFO [EnterpriseDT.Net.Ftp.Pro.ProFTPClient] 6 Apr 2006 10:22:18.000 : Trial license
DEBUG [EnterpriseDT.Net.Ftp.Pro.ProFTPClient] 6 Apr 2006 10:22:18.000 : Connecting to 192.168.7.193:21
DEBUG [EnterpriseDT.Net.Ftp.Pro.ProFTPClient] 6 Apr 2006 10:22:18.000 : 192.168.7.193 resolved to 192.168.7.193
DEBUG [b8] 6 Apr 2006 10:22:18.031 : Connecting directly to ftp-server 192.168.7.193:21
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 6 Apr 2006 10:22:18.062 : 220-FileZilla Server version 0.9.14a beta
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 6 Apr 2006 10:22:18.062 : 220-written by Tim Kosse (Tim.Kosse@gmx.de)
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 6 Apr 2006 10:22:18.062 : 220 Please visit http://sourceforge.net/projects/filezilla/
DEBUG [b8] 6 Apr 2006 10:22:18.078 : Created control-socket: ImplicitFTPS=False, SocksContext=, RemoteHost=0, controlPort=192.168.7.193, timeout=21, CompatibilityFlags=0
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 6 Apr 2006 10:22:18.078 : ---> USER bbosley
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 6 Apr 2006 10:22:18.078 : 331 Password required for bbosley
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 6 Apr 2006 10:22:18.078 : ---> PASS ********
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 6 Apr 2006 10:22:18.078 : 230 Logged on
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 6 Apr 2006 10:22:18.078 : ---> TYPE I
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 6 Apr 2006 10:22:18.078 : 200 Type set to I
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 6 Apr 2006 10:22:18.078 : ---> CWD FTP Test/SubFolder/
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 6 Apr 2006 10:22:18.078 : 250 CWD successful. "/FTP Test/SubFolder" is current directory.
DEBUG [b8] 6 Apr 2006 10:22:18.093 : Creating active data socket
DEBUG [b8] 6 Apr 2006 10:22:18.093 : Binding 192.168.7.193
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 6 Apr 2006 10:22:18.140 : ---> PORT 192,168,7,193,5,217
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 6 Apr 2006 10:22:18.140 : 200 Port command successful
DEBUG [h] 6 Apr 2006 10:22:18.140 : Created active data-socket: Protocol=b, SocksConnector=, CompatibilityFlags=0
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 6 Apr 2006 10:22:18.140 : ---> NLST
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 6 Apr 2006 10:22:18.140 : 150 Opening data channel for directory list.
DEBUG [h] 6 Apr 2006 10:22:18.156 : Awaiting a direct connection on active data-channel.
DEBUG [h] 6 Apr 2006 10:22:18.156 : Direct connection on active data-channel established.
DEBUG [h] 6 Apr 2006 10:22:18.203 : Attempt to close unconnected active data-channel.
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 6 Apr 2006 10:22:18.203 : 226 Transfer OK
DEBUG [EnterpriseDT.Net.Ftp.FTPClient] 6 Apr 2006 10:22:18.203 : Found 2 listing lines
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 6 Apr 2006 10:22:18.203 : ---> QUIT
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 6 Apr 2006 10:22:18.203 : 221 Goodbye

As you can see from the log, the PORT command being sent is specifying port 1497. This isn't anywhere near the range that I had set. In this case, the connection was a success because I had the firewall turned off, but if I turn on my firewall (which will forward ports 12000-13000), then the app just hangs while waiting for the data connection from the server because port 1497 is being blocked. This is yet another problem since the active data port never times out while waiting for the connection. I tried setting the timeout to 25000ms (25 sec), but it doesn't work. I am very interested in purchasing the PRO ftp library, but until these two issue are worked out, I can't.
0 votes
by (162k points)
Yes, it doesn't seem to be working for you. Can you post a code snippet? I just looked at our unit tests and it does seem to work fine.

I assume you are doing something like this:

ftp.ActivePortRange = new PortRange(lowPort, highPort);


As you can see from the log, the PORT command being sent is specifying port 1497. This isn't anywhere near the range that I had set. In this case, the connection was a success because I had the firewall turned off, but if I turn on my firewall (which will forward ports 12000-13000), then the app just hangs while waiting for the data connection from the server because port 1497 is being blocked. This is yet another problem since the active data port never times out while waiting for the connection. I tried setting the timeout to 25000ms (25 sec), but it doesn't work. I am very interested in purchasing the PRO ftp library, but until these two issue are worked out, I can't.
0 votes
by (700 points)
I'm doing this:
int[] tempPort = new int[2];
tempPort[0] = 12000;
tempPort[1] = 13000;
FTPConn.ActivePortRange = new PortRange(tempPort[0],tempPort[1]);

I am running the PRO demo if that makes a difference (just so that you know not to test on the free version). The dll name is "edtftpnet-pro-1.0.7.dll" and the file version in the properties is listed as "1.0.7.0". Maybe there is a newer version that I should be trying this with... :?
0 votes
by (162k points)
You're absolutely correct. I've found a bug (and fixed it). Sorry for wasting so much of your time. Please send an email to support at enterprisedt dot com and I'll send you a link to a patched version. If you do decide to purchase, email us just before then to remind us and we'll give you a discount for helping improve the product. Thanks.

I am running the PRO demo if that makes a difference (just so that you know not to test on the free version). The dll name is "edtftpnet-pro-1.0.7.dll" and the file version in the properties is listed as "1.0.7.0". Maybe there is a newer version that I should be trying this with... :?
0 votes
by (700 points)
Thank you for you prompt responses and quick fix. I have sent the email as requested. Do you have any idea what could be causing my other problem? I'm still having trouble with the timeout not working while waiting for the incoming active data connection. I found an old topic where somebody else had mentioned having the problem and I posted to there as well. http://www.enterprisedt.com/forums/viewtopic.php?t=747&sid=f40c6b5ab09088c27f2708e04dac2792. If there is any information I can give you, please let me know. Basically, my log looks identical to the one that I posted above except it stops on the line that says "Awaiting a direct connection on active data-channel.". At that point my application just hangs while waiting for the connection that never happens. This only happens if I try to use an active port that is being blocked by the firewall, but because the app hangs, it makes it very difficult for me to handle the error gracefully. In fact, in the current state, I can't handle it at all. The only way around that would be to put the code in a separate thread, but that is really overkill for my simple application. Feel free to continue this discussion in the other forum topic if it makes more sense to discuss it there. Thanks again for your help with the ActivePortRange problem.
0 votes
by (162k points)
Have emailed you with a fix for this to try out.

Thank you for you prompt responses and quick fix. I have sent the email as requested. Do you have any idea what could be causing my other problem? I'm still having trouble with the timeout not working while waiting for the incoming active data connection. I found an old topic where somebody else had mentioned having the problem and I posted to there as well.

Categories

...