Ftp.Users.Count (wodFTPServer)
by Michael, Friday, March 05, 2010, 09:32 (5378 days ago)
Hello,
I have a problem which might be related to threading issues.
I'm successfully running the FTP server component as a NT service from VB6 in XPSP3 environment. From a second application, I'm communicating with the FTP server via DDEML (no GUI) and this communication works fine (I'm using the Event viewer to verify the communication).
When I try to request server status, such as Ftp.Users.Count, this property report '0' even if I'm connected and downloading from/to the server. In IDE, the correct value is reported.
Other properties, e.g FTP.port report the correct value in both IDE and as NT Service.
I'm I missing some important information for the Ftp.Users collection?
Any suggestions are welcome.
With Best Regards,
Michael
Re: Ftp.Users.Count
by wodDamir, Friday, March 05, 2010, 11:04 (5378 days ago) @ Michael
Hi Michael,
Can you confirm that you are using the latest version of the component?
Also, can you please perform the same test for VirtualFiles.Count or VirtualFolders.Count? You can simply add a Virtual folder or file, and request it's count.
Regards,
Damba
Re: Ftp.Users.Count
by Michael, Friday, March 05, 2010, 12:35 (5378 days ago) @ wodDamir
Hi again,
I just upgraded from 3.0.2.283 to 3.0.3.293 but the problem is still there.
When adding a GLOBAL.virtualfolder and calling count, everything works fine. When adding USER.virtualfolder and calling GLOBAL count, 0 is returned (perhaps this should be the case?). For natural reasons I can not call USER.virtualfolder.count since user.count is zero.
Michael
Re: Ftp.Users.Count
by wodDamir, Friday, March 05, 2010, 13:09 (5378 days ago) @ Michael
Michael,
I can only assume that this only works for the main wodFTPServer object. Does it work if you internally use a global variable which you increment/decrement when user connects/disconnects?
Or, is there any chance you could provide us with something we could run on our side to reproduce this?
Regards,
Damba
Re: Ftp.Users.Count
by Michael, Friday, March 05, 2010, 14:00 (5378 days ago) @ wodDamir
Hi again,
Sorry if this is a double post.
Okey, at least one step more. I should add that I'm using IwodFTPDNotify interface and calling everything from a class module (all events are included).
Having a GLOBAL variable declared in a MODULE will catch connect/disconnect in a correct manner. However, if this variable is declared as PRIVATE, within the CLASS, does not work. Therefore I wonder how wodFTPDCom actually should be declared? According to documentation:
In class:
Dim FtpD As wodFTPDCom
Implements IwodFTPDNotify
Unfortunately, as the project is right now it will be difficult to pass on the code (SQlite DB connections etc). I will see if I can condensate the project just to illustrate the problem.
Regards,
Michael
Re: Ftp.Users.Count
by Michael, Friday, March 05, 2010, 14:34 (5378 days ago) @ Michael
One additional finding to last post:
If the variable is declared as PUBLIC (not GLOBAL) it is NOT possible to catch connect/disconnect. Strange, I have always thought that global declarations exists on VB6 only for backward compatibility.
Michael
Re: Ftp.Users.Count
by wodDamir, Friday, March 05, 2010, 14:51 (5378 days ago) @ Michael
Michael,
Basically, it shouldn't matter if wodFtpServer is declared as Private or Public. That's only an access modified which determines from where will your object be accessible from.
When it's declated as Private, it's only accessible from the same class it was declared in. When declared as Public, it should be accessible from anywhere in your application.
Unfortunately, we'll need to duplicate this issue in order to see why this happens. If you could try making a simple project that we could run on our side, that would be great. You can send such a project to techsupport@weonlydo.com
Regards,
Damba
Problem identified
by Michael, Friday, March 05, 2010, 15:30 (5378 days ago) @ wodDamir
Problem identified!
Running the program as compiled stand-alone-exe works fine. Even correct user.count is reported!
However, running the application as NT Service (NO GUI), the FTP server as such works fine, but I have obvious problems to get a reference to the wodFTPDCom object.
With these conditions I understand that it is difficult for you to provide support.
Michael
Solved
by Michael, Friday, March 05, 2010, 15:55 (5378 days ago) @ Michael
Problem finally solved - I feel really stupid!
The problem was that two instances of the calling class module was initiated, leading to incorrect reference. This only took place when running the server as NT service.
Sorry for bothering you and thanks for guiding me to find the source. Your component works perfect even when running as NT service.
For those who are interested in running this component as NT service, there is an excellent vb6 type library here:
smsoft.ru/en/ntservice.htm
Have a nice weekend
Re: Ftp.Users.Count
by wodDamir, Friday, March 05, 2010, 15:58 (5378 days ago) @ Michael
Michael,
Great! I'm glad that you did find the solution to this problem after all. I'm glad if i was helpful.
If you encounter any issues using the component in future, let us know, and we'll try helping in any possible way we can.
Regards,
Damba