Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > CGI, Javascript, DHTML, for some kind of download que'er?

CGI, Javascript, DHTML, for some kind of download que'er?
Thread Tools
Junior Member
Join Date: Oct 1999
Status: Offline
Reply With Quote
Aug 1, 2001, 05:12 PM
 
ive looked all over, and ie come pretty close but havent found one. I run a webpage with a low bandwith outa my closet, and its use is for people to download files. I can only allow 20 connetions at a time, so its a pain in the ass for someone to download after the 20 spots are taken. does anyone have, or can anyone whip up a cgi script or javascript, etc that has at least a Download Que featiure? thanks!
     
Clinically Insane
Join Date: Nov 1999
Status: Offline
Reply With Quote
Aug 2, 2001, 07:40 AM
 
It's not quite as simple as you'd think. The problem is that HTTP is a stateless protocol, which has its advantages, but also has its disadvantages as well, among them being this.

What you're trying to do is, unfortunately, rather complex. What you'd have to do is keep a program running at all times, as a "queue server" of sorts. This would keep track of how many connections were taking place, and also manage the queue if there were too many connections. Then you'd want to use a session cookie for each user, to give them each an ID. The last piece of the puzzle would be a CGI or other server-side script which told the user where they were in the queue and also refreshed occasionally; this would have to interface with the queue server.
Things like this have been done before. The logo generator at http://www.cooltext.com has a queueing system not unlike the one you describe. But unfortunately, it just isn't an easy thing to do.

The hardest thing to do would be the queue server. Not so much in terms of making it as in terms of letting your web host allow you to run it, because this wouldn't be a standard CGI script, but rather a full-blown background process, not unlike a chat server. If you have your own dedicated server, though, this isn't an issue, and then programming becomes the hard part again.

Then, there's the problem of the CGI. The real issue here would be interfacing with the queue server. This can be done (Unix sockets, Apple Events if you're using a Mac server, and so on) but it's fairly advanced stuff.

The session cookie would be the easy part (simple JavaScript would do), except that some users have browsers that don't support cookies, and many users disable them in browsers that would otherwise work. There are potential ways around this (track via IP address and only allow one download at a time, for example), but these have their own issues.
What sort of things have you been looking at, by the way? Like I've said, this kind of thing has been done before, and if you can find an Open-Source system similar to what you're looking for, you may be able to modify it to fit your needs.
You are in Soviet Russia. It is dark. Grue is likely to be eaten by YOU!
     
Junior Member
Join Date: Oct 1999
Status: Offline
Reply With Quote
Aug 2, 2001, 12:23 PM
 
yup, what you say makes a lot of sence. I got the idea from Fileplanet.com. they actually have a real file queing system for when they run out of bandwith. cool huh?
     
Mac Elite
Join Date: Mar 2001
Status: Offline
Reply With Quote
Aug 2, 2001, 03:04 PM
 
Why don't you just use something like Aimster or Carracho where you can limit the number of users?

If you' re using *nix of Winblows, you can limit the number of connections (~users) to your machine.

Most FTP servers can also limit the # of concurrent logins.

The point here is: Avoid doing it with HTTP because there are easier solutions that have been time-tested, and free for you.
     
Addicted to MacNN
Join Date: Sep 2000
Status: Offline
Reply With Quote
Aug 3, 2001, 08:29 AM
 
Here is the best I can think of:

Run an FTP server, then using a banner.msg (or equivilant) have it say something like "9 out of 20"

If you want it to look like http is being used, write a perl script that would connect to the FTP server, and have it capture the message when it logs in and relay it in the CGI output. If it can't connect then have a reload meta tag to reload the page in 30 seconds and run that perl script over again redoing that task. That's the best I can come up with.
I always use protection when fscking my Mac... Do you?
     
Junior Member
Join Date: Oct 1999
Status: Offline
Reply With Quote
Aug 5, 2001, 12:24 AM
 
Ok, well im running AppleShare IP 6.3.2, maybe what was said above, some kind of banner that would at least show how many people are connected, without having to refresh? how about that ind of cgi?
     
Addicted to MacNN
Join Date: Sep 2000
Status: Offline
Reply With Quote
Aug 10, 2001, 09:42 PM
 
Checkout what I did on ftp://ftp.accettura.com

Very simple and shows how many are connected.
I always use protection when fscking my Mac... Do you?
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 12:36 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2