Download Reference Manual
The Developer's Library for D
About Wiki Forums Source Search Contact

Changes between Version 16 and Version 17 of ChapterVFS

lmartin92 (IP:
03/28/09 14:04:34 (10 years ago)



  • ChapterVFS

    v16 v17  
    366366== !FtpFolder == 
     368This driver manages passive FTP connections. It allows for the treatment of a FTP folder as if were locally mounted, excluding the intialization phase of a FTP folder. When creating an instance of any of the classes in the FTP VFS adapter, all that is required is for the server name, and the path name to be provided. The server name is the name of the FTP server, and the path name is a name of a path, or a name of a file. The server name will not work with "" but only works like "". The path name works where all that has to be provided is the name of the path or file residing on the server. For example, the name of a path could be "/directory" and the name of a file "/directory/filename". This VFS driver has some non-standard features which will be noted later, especially the part telling of how to access these features. They are part of a proposed standard that is not implemented up to this point but can be implemented though. This driver works around some common problems that can occur in a connection to a FTP server. For instance, some servers only allow a certain number of concurrent connections at one point in time. To keep from encountering this limit, this implementation connects per method called such that almost any call to any function in this driver will result in a new connection, and the closing of that connection after the information needed is gained. However, it is done a bit differently in the FtpFile class so as to allow reading and writing of large content without sitting in the method all day. In the FtpFile class, it keeps around it's connection until it is finished writing. The reasons behind this are too complex to be written out in this document. 
     370Creating a connection is as simple as 
     374auto entry = new FtpFolderEntry("", "/directory", "username", "password", 21); 
     377Note that the last 3 arguments are completely optional. Those set of arguments are pretty much available for use on every class in the FTP VFS adapter. 
     379To access a file, using the entry we created above, all that has to be done is, first open the folder, then ask the folder to open the file as the following example shows. 
     383auto folder =; 
     384auto file = folder.file("filename"); 
     387Do note that is is usually good practice to check for the existence of a folder and if it isn't there, and it is wanted there, it is best to create it. To do the check and create the following example is provided. 
     392    entry.create(); 
     395The same can be done to a file. 
     400    file.create; 
     403Now we have accessed a file at "" assuming that that place is actually in existence. Do note however that it is impossible to create "" through programming; to do that, one would have to physically buy the domain and much more that is past the scope of this document. Just note that this can not be done through programming. 
     405This is some of the basic set of functionality. To learn more, one could read the documentation, or read the code (latter is preffered). Just look at the function signatures as they are pretty understandable, self-explanatory, and work a lot like most other drivers. 
     407Now we have got to the point at which non-standard driver features will be discussed. As they are not yet available in the standard interfaces, it will have to be done by directly using the FTP VFS Adapter classes. Basically, no "auto that = new that();" stuff. The only non-standard driver options provided are some time functions. They are part of a proposal and apparently the author of the code decided to pre-implement them so as to save himself some work in the future. To access these proposed functions all that has to be done is: 
     411FtpFile file = new FtpFile("", "/directory/filename", "username", "password", 21"); 
     412//initialize a file to connect to at 
     413auto time = file.mtime(); 
     414auto time2 = file.ctime(); 
     415auto time3 = file.atime(); 
     418mtime() and atime() are the same as the functionality requested is not available in the FTP standard and this was the closest the author could get to it. mtime() is for time modified (as is atime()) and ctime() is for time created.  
     420This is the basics, happy coding!. 
    368422== !WebDavFolder ==