Windows Develop Bookmark and Share   
 index > Windows Forms General > getting media files from a winform
 

getting media files from a winform

I am designing a winform client that should get around 30 media files (mp3, mp4 etc) in the

size of 10 mega. every X minutes the client will check for updates, and if it finds any it should

download the new media files from the server.

what is the most efficient/fast way of transferring those file to the client?

1. ftp?

2. binary format with Windows Communication Foundation? (and I can notify the client about changes so no need to check for updates)

any other options or considerations (security?)

oren  Tuesday, September 12, 2006 12:25 AM
Well, about the 30 MB and web services, you're right! The problem is that web services will only transfer data using serialization and usually to XML which means that a 1 MB file is maybe going to be transfered as bigger file due to size increase through serialization. It can be a good solution in one condition, that you get a power horse server if your clients are expected to increase during the future to thousands or so. The WCF is a good choice. If you want to consider clients behind firewals, you might make your client detect if there is a firewal and if there is, you might provide an alternative method of transfer through HTTP that's limited to users behind firewals that do not support binary communications. But in general, binary is of course the best in terms of speed and performance. However, if you choose togo binary directly over the internet, I think you will face troubles with security issues.
CSharpFreak  Monday, September 18, 2006 5:25 AM

That depends on whether your application should work behind firewalls, whether the server is supposed to operate in a LAN/WAN/The internet and whether there are any restrictions on the protocol you use. Usually, using TCP gives the most effecient results but it doesn't work fine with most firewalls (most network administrators block things on their firewalls)Http/Ftp will be your second choice.

To use these protocols, you will need to take a look at the System.Net namespace, See the WebRequest.Create method, and take a look at the FileWebRequest, FtpWebRequest, HttpWebRequestClasses. You will need the Response companion classes of these (FileWebResponse, FtpWebResponse ... and the abstract WebResponse class)

If you decide to implement using raw TCP, you will need to look at the sockets infrastructure and you will need to have access to the server application code. Again, it all depends on your application and how is it supposed to contact the server.

Is the server a web server or a custom application you are working on?

CSharpFreak  Tuesday, September 12, 2006 1:13 AM
thanks for the quick reply,

It's my network and my server so i guess i can control the firewall settings.
The server is a web server, not custom application.

what is the performance and security diferences between the two options you mentioned?
Is there good documantaiton/tutorial about both options?
oren  Wednesday, September 13, 2006 12:21 AM

hmm... must you transfer the files if its on your own network?

looking for/scanning everyfew minutes will be expensive if using TCPClient/Sockets since you have to establish a connection every time and so on and so forth and would not be effecient.

the best way if doing this would be in raw binary format. But still - why do you have to transfer the files locally if its on your own network? Just curious to see if I can provide a better solution and architecture to your app

ahmedilyas  Wednesday, September 13, 2006 12:52 AM
Have you thought of media stream?
gqlu  Wednesday, September 13, 2006 2:11 AM
ok, maybe i wrote the wrong thing.

it's over the internert, not my own network.
the media files are located in my server and the computers with the winform app are all around the world (for the sake of the argument).
oren  Saturday, September 16, 2006 1:38 PM

From what i understand, the media files are yours and are on your server and the WinForms client will be used by your users to view the files and at the same time be updated on any changes on the files.

Now, let's suppose your users are located on your network at first. That leaves you with an open set of options and your main concern becomes performance and any security issues you may have with users modifying the files. On this scenario, i think the best will be to transfer them using mere IO through UNC files. But that will require you to modify permessions on the files to allow only reading of the files for the public. That should be relatively easy and secure over your network using NTFS and AD permissions infrastructure.

Now the next step will be assuming your users are all over the planet, with your files exposed merely through web technologies (FTP/TCP/HTTP ... etc) In this scenario, and if what i remember is correct, performance will be best through FTP then TCP then HTTP (in units of speed) becasue of the extra headers and sesions added by each protocol in the chain. However, a methodology that is gaining much popularity and praise is using Web services for your purpose. This will be through creating a web service that exposes methods to download the files and others to query update information. This will give you the following extras:

1. You're in control of the security mechanism, and you can use layered security levels (with NTFS at the bottom, Web Forms authentication above it and maybe any other security protocol above them all (session tickets, expiry policy .. etc.))

2. You can totally hide your files deep in your network as the web service is the users point of contact, the user will only have the address of the service and nothing more, no infomation on where your files are, what they are named ...etc.

3. You can later upgrade your security measures, enhance implementation of the webservice and change the files location and format with nearly no cost(if any at all) on the client side

4. You can notify the users of updates not only to the media files, but also to the client program itself and make it possible for them to update the client without requiring any experience in using computers.

5. You can support pausing/stoping/resuming download of media files on your client

However, this comes on the cost of performance. Web Services operate based on HTTP and that - many will argue - is slower than other protocols. I don't know about you but, for me, just the ability to give my users the feature of pausing/resuming their download can be enough.

In my opinion, this might just be your best option. BUT, that's just my opinion.

Hope this helped

CSharpFreak  Saturday, September 16, 2006 3:30 PM
I think web services will be too slow for my situation - downloading 30 MB of content a few times in a day might not be very scalable (if I will have thousands of clients in the future).

I know that WCF (windows communication foundation), that is available today, supports binary format (unlike web services) so i thought it might be better.
In addition to that advantage, WCF allows my server to initiate a call to it's clients, so any change in the play list on the server will send a message to the relevant client, and the clients don't need to check for updates every X minutes.

what do you think?
oren  Sunday, September 17, 2006 4:45 PM
Well, about the 30 MB and web services, you're right! The problem is that web services will only transfer data using serialization and usually to XML which means that a 1 MB file is maybe going to be transfered as bigger file due to size increase through serialization. It can be a good solution in one condition, that you get a power horse server if your clients are expected to increase during the future to thousands or so. The WCF is a good choice. If you want to consider clients behind firewals, you might make your client detect if there is a firewal and if there is, you might provide an alternative method of transfer through HTTP that's limited to users behind firewals that do not support binary communications. But in general, binary is of course the best in terms of speed and performance. However, if you choose togo binary directly over the internet, I think you will face troubles with security issues.
CSharpFreak  Monday, September 18, 2006 5:25 AM

You can use google to search for other answers

Custom Search

More Threads

• Leaving a treeview node
• How to Integrate MS Word Viewer in to the WinForm Application
• combobox drop-down size/location
• Hiding Printing Dialog Boxes - Is this possible?
• Form paint while OnLoad processing ...?
• Is there a TextTrimming mechanism that trims inside the text?
• Making a window the background
• Disable TreeView node selection?
• How to change text from form2 in form1
• blocking images similar to outlook in WebBrowser control using C#