-3

There is a program which sends image files in binary by using WebClient.UploadFile(someUri, "STOR", filename). I can't change that program, but I need to build a program to receive the file. I don't want to implement a full FTP server, so what should I be looking at to create the bare minimum logic in C# to receive the file? A bonus would be a solution that uses features present in .NET 3.5 or 4

I don't really know where to start, so any tip is appreciated. Thanks.

  • Can you just use an FTP server application and work with the files after they are uploaded? – khargoosh Mar 14 '17 at 00:38
  • I thought about this, it is definitely an option, but there is a possibility that I would want this to run on mobile devices as well, in which case I'd want the server to be built into the program. Thanks for the suggestion though. – Ivaylo Parvanov Mar 14 '17 at 14:28

2 Answers2

0

It sounds like you'll need to provide not an FTP server, but an HTTP server (aka a web server). From a little quick Googling, it looks like there's a library for embedding a simple web server into a .net application named Nancy that a lot of people seem to have good results with: Embedded C# web server?

Of course, this would be the quick and dirty way. Probably a better long-term approach would be to create a normal ASP.Net website to receive the images, hosted on a normal IIS web server. But if you have no experience in web development, that might be biting off a lot.

Community
  • 1
  • 1
Joe Irby
  • 649
  • 6
  • 7
0

Thank you for the suggestions, but through more digging around I found out how to implement what I need. This is a very simple ftp server done in python using sockets. I was able to easily replicate this in C# using sockets again and I have adapted it to be able to authenticate a user of my choosing and write the received files to the disk.