Why I chose Silverlight over Flash for my FTP client

UPDATE: I have been having issues with silverlight sockets so this project hasn’t been finished. If anyone had any luck with something like this please share your experience. Thanks


I made this File uploader that connects to an FTP server to upload customer files, I use the https://www.sodapdf.com/compress-pdf/ to convert them into pdf. My first instinct was to use flash and action script. The project went smoothly and development was rather easy, I was impressed by the simplicity of the Actionscript sockets. It turns out all that simplicity came at a price, just a few hours after deployment some users could not upload files, the app would hang and crash some browsers.

After a few minutes of researching I discovered that the files that caused this problem were large files. The size of the file that caused the problem was dependent on the system, older systems with small memory would crash with files that were 200MB while others could handle 1GB files.

as it turns out my problem was that Flash could not load a file partially. you pretty much have to load the entire file to memory to send it with a socket. then there is the problem that flash doesn’t support any sort of bytesSent property of progress event handler.

While .net sockets don’t support progress event handlers they do provide with the bytesSent property. also FileStream allows for the partial loading of a file. All this translates to two thing:

  1. I can read a file piece by peace, so now i can send 1GB files from any system.
  2. Since i can read a partial file I can now resume an interrupted upload.

Silverlight Sockets areĀ  harder to implement thought, since all receives and sends are asynchronous any method that updates the interface needs to be implemented as a delegate. You also need to keep track of the order in which messages arrive. A simple way is to block the application and make it wait for an eventComplete from the socket using and Autoevent.

So in conclusion I ended up using Silverlight for my FTP Client because of the flexibility that FileStream provided and even thought Sockets in Silverlight are more difficult to implement, now I have a more robust application for my customers.

P.S one bit of advise is that if you must receive and send messages at the same time in the same socket, use two socketEventArgs, one for sending and one for receiving

7 Comments


  1. This is totally random, but I couldn’t find where to send you a personal message. I am on 2nd gen Xterra form and came across the hatch tent thread; however, the images are not being shown.. Due to movement or something.. I was wondering if you could email me those pictures of the Xterra hatch tent at rthinchey@yahoo.com

    Thank you so much!

    Reply

    1. Let me see if i can find them

      Reply

  2. Hi Carlos,
    Its good to hear you chose silverlight for the FTP client, can you share your experience or some sample code on how to implement this, upload files thru FTP client using Silverlight application. This would be of gr8 help for me. You can mail me at srinath.ns.15@gmail.com, or if you have blogged it, pls share its path !

    Thanks !

    Reply

    1. The only problem i had was on Directory listing. I could never get the entire contents of the remote directory. was this ever a problem for you?

      Reply

    2. I could get more or less 100 files in the directory listing so the rest never made it.

      Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.