The principle of setting up files on a server to be downloaded and installed by a web user is a black art to me. Could anyone explain how I can do this.

I'm assuming that by "downloaded and installed" you mean that the web-server installs the files/applications to the client/local computer. If that is case, then no. This never happens. A Web-server is a program that runs on a server.... what it is not... is HTML, javascript, ActiveX, or any of the other scripting/programming languages that it (the webserver) dishes out. That said.... most of the time, these web-sites that infect your system, do so by finding flaws (exploits) in the web-browser's code. So, someone studies, say, Internet Explorer's .dll file (or perhaps the .exe, depending) and finds out exactly how it deals with, I dunno, javascript. Once they know how it deals with javascript, they can figure out where mistakes were made (or if it was simply careless programming.... Microsoft). Now they can carefully design a javascript, which executes onload, and makes use of that mistake or careless programming.

What I mean is...If I go to a web site and it has software that can be downloaded...then you click on a button and lo...that software is downloaded to your computer.So how can I set up software on a server so that people can download it.


Ok, you need to look into using sockets (winsock or socketwrench... I like socketwrench better, but winsock will get the job done). Then, you need to connect to the web server with the socket... chances are it will be running on port 80, but this is not a requirement. Once you connect to the socket, you need to pass it an "HTTP Request Header." That header would include the server's path (relative to the web server) to the file. Then, the webserver would return a mime header (HTTP Response Header), that you would need to basically check (in order to make sure it's not a 404 error, or some nonsense). If the response is ok (like 200) after the 2 line breaks would start the actual file. You save that in a file with your open command, and call it a day. The process might be something more like "read from socket, write to file, read from socket, write to file", but the idea is the same.

There is an easier method if you follow this link through to it's conclusion (or I guess jump to the last post). This should give you a pretty good idea of what's happening.

Thanks Comatose, I really wish I knew what you were talking about.
forget for a moment how I get the software to the server, lets concentrate how some user out there in cyberspace gets it off my web site. Also is there anything in the setup kit that will prepare the project to be downloaded..or don't I know what I am talking about.

I guess I'm slightly confused about what you are trying to do, so let me try this:
a web server is a program running on a computer somewhere. One computer can run many servers (I have a server that runs a web page (web-server), runs a mail server program, runs an irc server program, a DNS server program, and an SVN server program). This would cause some kind of problem, but each server runs in a different slot on the network connection called a port. These ports are represented by numbers. For example, if I connect to that remote computer, and tell it to use port 80, then it knows to use the web server (assuming the web server is running on port 80... this is not a requirement, just a stern suggestion from IANA). Now, I tell my web browser to connect to My browser knows to try to connect to port 80, on When my web browser connects to, it says "hey google, how about you get me this file." Sometimes that file contains HTML (web page code). Sometimes that file is a .txt file... and sometimes it's a file that the web browser doesn't know about... so it asks you to download it. The web-server doesn't care... it has no idea what is in the file....and it doesn't want to know. It simply accepts the connection on the port, sees if the file you requested exists... if so, it opens it up, and spits out it's contents to the network connection. The client (program that initiated the connection) does all the translation and downloading and everything. It is the beast that knows "hey, this is an image... I should display it" or "hey, this is HTML, I should make a web page", etc. So, when the browser gets the data, it decides what to do with it.
1) client connects to web server on specific port
2) client requests specific file
3) server checks if file exists (if not responds with 404 error)
4) server opens the file, reads the contents
5) server spits out contents of file to the connection
6) server disconnects the connection.
7) It's that easy.

This article has been dead for over six months. Start a new discussion instead.