I'd like to build an home FTP SERVER - that will store all my files and the rest of my computers will upload and download files to and from it.
I don't like to start from scratch, do you know of a c# ftp server implementation?
Can you give me some guidelines of where to start what I should know etc?
Based on a few of your comments why do you not just enable the FTP server through IIS on one of your computers in your network, or just enable file sharing? These things are already partof/included in Windows at your disposal.
You say you don't want to start from scratch, so use something that's already been through the pain: http://filezilla-project.org/
The FTP RFCs for the protocol specification and the System.Net.Sockets namespace.
And read as much as you can on security (mailing list, bulletins, books, ...) because you can very easily leave holes for anyone to get to your files.
(I don't know of any FTP libraries beyond what .NET includes (I've not needed any FTP), but there are also third party networking component libraries that may include richer functionality. You'll likely still need to understand what's going on for debugging.)
You first need to understand the protocol: RFC959
Here a basic server in C#: http://www.c-sharpcorner.com/UploadFile/ivar/FTPServer12072005041005AM/FTPServer.aspx
Read on security...
Related
I have been making a simple ftp of my JCL after sending site filetype=jes with my C# code.
However now I am required to use SFTP to send and receive files.
I found renci.SshNet but it does not have a method to send command.
Can someone please tell me how I can SFTP a JCL to mainframe using C#?
What is the best method to go about this?
SFTP (not to be confused with FTPS) is not supported by .NET out of the box. You have to rely on a 3rd party library. See related question here: SFTP Libraries for .NET
The answer for your stated problem is that you need FTPS and not SFTP to support JES extensions for job submission and retrieval (as well as other z/OS specific capabilities).
Here is an article that goes over the details of FTPS in c#. Its the same command sequence using the SITE command as you used under FTP.
For a comparison of SFTP and FTPS here is some information.
Found this link about FTPS setup on z/OS from Share. This should get you started. It seems more practical and applied than going to knowledge center and shows the various options and capabilities. The original author, Alfred B Christensen, is an IBMer. The material is from 2011 but is still mostly applicable today.
Here is a comparison of the technologies:
Here is some more background.
The issue is that ...sftp understands a set of commands subcommands similar to those of ftp. according to the linked IBM manual for SFTP. The sftp server implementation provided by IBM does not have the full set of extensions provided by the FTP Server
There are other servers out there with associated clients that can provide the capability. I'm not endorsing this product but it seems to be popular from google searches I've done Tectia The default implementation of sftp server from IBM does not support the same extensions that ftp does.
If you're looking for a seamless transition and need transport security ftps is a better option but likely requires configuration on the z/OS system if its not already enabled.
The issue is not simply the client, it is the capability of the sftp implementation on z/OS as well.
The native SFTP from IBM does not support all the features of FTP. You will need to use Co:Z toolkit SFTP from Dovetailed. It's free to use with paid support available.
I need to create a C# client with .NET Framework 4.6.2 to connect a server.
My client offers me the possibility to connect to a SFTP server or to a FTPS server, but I don't know which one is the best to connect with.
On this page, I have found this:
No built-in SSH/SFTP support in VCL and .NET frameworks
I need to connect to a server to upload and download files. I also need to monitor a directory on the server to know when a file is on that remote directory.
Searching on Internet I'm not sure if the .NET libraries (SSHNet) that implements SFTP protocol are good enough to a production environment.
I think SFTP is the best option to use but FTPS could be easier to implement a C# client for it.
Or maybe I can use libssh2 to implement a C program that do the job to monitor a remote directory, download any new file on it and upload the files that I need to upload.
Any advice?
If both protocols are fine for your actual needs (as suggested in your question and comments), if it's only a matter of "what's the easiest to use in .Net", I would simply go for FTPS.
It's very fast to implement, since you'll find all what you need in the framework ("FtpWebRequest" class, or more recently "WebClient", etc), even on old versions of the framework.
You can find plenty resource about this on the web or on SO
You have mentioned that you need to "monitor" a folder on remote server. Of course there's no problem with FTPS to retrieve the list of all files of a folder, but it will be in "pull" mode, as frequently as you wish. There's no way for the server itself to push you a notification every time a new file has been dropped. So if you need some real-time notifications, it's not optimal.
Sorry I think I am finally asking the right question. First I asked Create a shell namespace extension
Anyways I am synchronizing and sharing files between two peers just like drobox but with larger data. I was wondering how could I create a web share or ftp share server so that I can connect to it from windows.
For example when you click on:
Then
if I select ftp://ftp.microsoft.com
then this is what I get:
From researching on the internet I saw that IIS supports this. I was wondering if there are some libraries that will enable me to create this server on c#.
You could use Apache server to do turn your computer into a hosting server. Apache comes with many software packages such as xampp, wampp which help reduce installing time.
How do I map an ftp share folder to a local drive using C#? Is there any class library available for this?
I need to achieve the same functionality as NetDrive(http://www.netdrive.net/) offers using FTP ?
Maybe you can leverage someone else's work and get a headstart. The makers of NetDrive for instance offer an SDK - not sure what that requires / costs, however. But it might be worth an inquiry, no?
And maybe, if you combine this approach to define a remote FTP site as a Windows network share, and then use this code in C# to mount a network share as a drive, you might get your job done :-)
It's a very tall order - if you actually want a local drive, e.g. X:\, to access an FTP site, you'd surely need to write a driver. Not an easy task.
If you want it to simply appear in Windows Explorer somewhere - you can use the shell extension as Marco's answer suggests. But don't expect to be able to treat it like a regular drive.
To create a virtual drive or a folder on existing drive and expose remote FTP server contents that way you need a filesystem driver. Or use can use our Callback File System (CBFS) product which lets you write the code in user-mode and includes a pre-created filesystem driver. CBFS includes a sample, SFTPDisk, that does exactly what you need, but with SFTP protocol (SFTP is not FTP but SSH File Transfer Protocol).
Note, that in FTP there's no function to upload a block to the middle of the existing file. This makes some file write operations trickier than with SFTP or local filesystem - you may need to cache the whole file and upload it asynchronously when it's closed by the client.
There's a project in C# to use an FTP folder as virtual drive -> http://amalgam.codeplex.com/ (it uses dokan).
There's a freeware program that does the same thing -> http://www.ferrobackup.com/ftpuse/
My Windows client application (written in C#) works with the remote MySQL database deployed on *NIX server.
I'm going to add the ability to store files on the server. I was never fond of storing files in DB, so the files will be stored in the file system. The application will need to upload, download, and delete files from server.
Any approach I can think of requires additional service to be deployed on server.
So far my favorite is SFTP*, but there are other solutions which are IMO inferior:
Web Service - are there any? haven't done any research in this direction.
FTP server - brings at least all the problems connected with protocol itself
WebDAV - interesting option, considering there is Apache module and .NET libraries
Some ad-hoc script (clearly the worst solution)
*I intend to use SharpSSH library, and public key authentication to access special account on the server which will be restricted to SSH operations only
Edit: corrected some terms confusion, thanks to #vartec
SCP has rather limited functionality. SFTP and FISH give you a lot more then plain SCP. (note, that SFTP should not be confused with FTPS)
Example of SFTP C# implementation.
Advantage over other options — no extra configuration at server side required.
I would use vsftpd on the *NIX server side: it's small and easy to configure, and I haven't had any problems with it since I initially set it up about 6 months ago so it's also reliable. I just use regular FTP, but you can do SSL with vsftpd if you're concerned about security.
On the client side there is this free, open source, FTP Client Library for C# made by Dan at C-SharpCorner.com. It works, and it's easy to extend its functionality to do more things. For example, I added a function for changing file permissions on the remote server.
putty and winscp are all you need.