creating an ftp server - c#

I am trying to create a ftp server in c#.
This server should listen to any ftp requests, and if a file is sent from a remote location, then the server should write it to a specific folder.
I am using VS2008. Do I need a tcp listener? FtpWebRequest? FtpWebResponse?

Don't know if writing your own FTP server is the way to go here.
Wouldn't it be easier to install a pre-rolled FTP server, and have a job that polls your FTP upload directory? This job will identify incoming files and then places them where you need based on a set of predefined rules.

Can't you extend IIS ftp service?
For example: http://learn.iis.net/page.aspx/673/how-to-use-managed-code-c-to-create-an-ftp-authentication-provider-with-dynamic-ip-restrictions/
Or as you asked: http://learn.iis.net/page.aspx/579/advanced-logging-for-iis-70---custom-logging/

I believe a TcpListener would be easiest to work with
There's an old article on it here that should still be usefull: codeguru

Related

Send and receive a file using .NET WebClient or related objects

First of all, I'm completely open to suggestions for alternative strategies, since this is not a space I'm hugely familiar with.
I have what I think is a simple problem. I have a client app and a server app, and I want to send a bunch of files from the client to the server. I don't want to require the user to set up file shares or anything, so my thinking was:
I'll have an app on the "server" using HttpListener to listen to file transfer requests from the client.
I'll have an app on the client using WebClient.UploadFile to initiate the transfers.
Twist: The server is a Mac, and I need to use things that are supported by Mono. I'm not looking to have the server install ASP.NET / IIS / whatever. In fact, the less the user has to do, the better. (The user in this case will be in control of both the client and the server, by the way.)
So, short questions:
Is there a better/easier way than WebClient/HttpListener to send a bunch of files from one machine on a LAN to another? TCP-something? Sockets-something-or-other? (You can see my ignorance.)
Assuming I use HTTP, are there more straightforward ways to download files than using an HttpListener and manually parsing the requests to get rid of headers, etc.?

Send files over static IP from clients to server

I'm a newb in this thing. I want to send files from a few client systems to a server over static IP. They're connected via a LAN. The files are created on a WPF app on clients and should be sent to the server which also has a WPF app.
The easiest protocols to you will be the ones you don't have to implement yourself. Can you use shared network drives, ftp or http? WCF would also be easy to implement, even if it's overkill.

C# - Send a file over HTTP

In a server / client environment, I need to send a plain text file over the HTTP protocol.
Typical scenario:
A client joins the server, and the server sends a string telling the client a url to download a text file. The URL would be:
"IP:PORT/folder/folder/file.txt" (where 'IP' and 'PORT' are actual
IP's and Ports IE: 127.0.0.1:1234)
I need the server to allow a connection to the files location, and the files location alone.
The client is closed source, and so I have no control over its code. It should act like a HTTP server, but only for that file, or at least the subfolder. You should be able to type in the URL into a browsers address and read the contents of the file.
What's the best way of doing this?
The easiest way would be to use the HttpListener class.
The documentation contains an example which shows you how to set up the listener and receive a request, but it does not directly cover how to check what file was requested and how to feed that file back to the client. However, both are easy to do and would not take a lot of code.
You can try to use an existing webserver like Apache to serve those files.
Also if this is some kind of learning exercise. You can implement your own simple HTTP server in C#

Looking for a Best Practice: Communication between 2 Applications for Filebrowsing and Download

I'm sorry if this Question is redundant but I'm totaly confused and I need some advice for a Best Practice. It's just for learning purposes but for me this is important because I want to figure out how to do things in the best way.
I want to create an application that let's me Browse the Filesystem of my second PC over the Internet connection, not the lokal Network. So, on PC1 I want to have a small Application (App1) that shows the Filesystem in something like a Listbox with simple Navigation (Doubleclick to open a Folder ad a Button to go up one Level in the Filesystem) and a Download function that let's me Download a File from this PC an on PC2 is the counterpart (App2) that interacts with the Application on PC1. App2 reads the Fileysystem and sends the Folder and Filenames to App1 and App1 asks App2 then to get a specific File.
Now I have to specific Questions:
What technology is the best for communication between those to applications while communicating over the internet? WCF? My own protocol over a socket connection? Something else?
How can I manage to download a big File in several session? If the connection drops I want to resume the download and not start all over again.
I hope someone can give me a hint
Thank you very much
CaptnCrash
Use the FTP protocol for this. On the second PC install and configure an FTP server application, and then in your C# client code, use something like http://sourceforge.net/projects/dotnetftpclient/ to do the FTP protocol work.
Alternately, if you really need encryption of communications, use HTTPS which means configuring a web server on the second PC and using something like the System.NET classes to implement a web client.
Whatever you do, do not write your own protocol and do leverage existing .NET libraries to handle the lower level FTP or HTTP communications.

Available options for hosting FTP server in .NET application

I need to implement an FTP service inside my .NET application (running as a Windows Service) and have not had much luck finding good/current source code or vendors. Ideally it needs to be able to respond to the basic FTP Protocol and accept the data stream from an upload via a stream, enabling me to process the data as it is being received (think on the fly hashing).
I need to be able to integrate it into my service because it will stack on top of our current code base with an existing custom TCP/IP communication protocol. I don't want to write (and then spend time debugging and performance testing) my own protocol, or implementation.
I have already found plenty of ftp client implementations, I just need an acceptable server solution.
There is an article about rolling your own FTP server in C# here. It's a bit old, but it might be complete enough for your requirements.
If you can get away from the need to process inbound data on-the-fly, I'd suggest just using an off-the-shelf FTP server (maybe even IIS), and process the received files from a folder. Your service could easily monitor this folder for new files. The other benefit of this is that files could be received even if your service is not running or restarting, and testing would be easier as you can drop your own files into the monitored folder.
Good luck!
Hope you find RemObjects free IP nice to use,
http://www.remobjects.com/ip.aspx
After installation you will see the samples.

Categories

Resources