And you would use delegates or what for the threading?

Mark

On Sep 8, 12:51 am, CK <[EMAIL PROTECTED]> wrote:
> Indeed, MSMQ is very large an does have a lot of overhead.
>
> If you need a queueing system, I propose the following:
>
> Have a class that has an int to record the number of items currently
> being downloaded.
> Have a generic queue as mentioned in the previous post.
> Have an Int16 that records the max number of items to be downloaded at
> once.
> Have a method that checks for the number running and if it is then
> than the max and the queue has items, call the start running method.
> THis should be called every time something is added to the queue.
> Have a start running method that increments the number running and
> then does the download, then removes the item from the queues and once
> doen, decrements the number running.  This must then call the previous
> method again.
> Have a method that allows item to be added to the queue.  This should
> call the checking method.  This should be the only public method.
>
> Try that out.
>
> On 4 Sep, 16:18, Joeizy <[EMAIL PROTECTED]> wrote:
>
> > Just a side note... MSMQ is just a queueing construct supported by the
> > OS instead of you application. MSMQ can also be accessed by multiple
> > applications. One more benefit is that the items in a MSMQ queue will
> > be preserved if you application closes and reopens. A major downfall
> > could be that the some computer must be running the MSMQ service,
> > either the computer that your application is running on (this requires
> > your user setting up their computer) or you must have a server running
> > MSMQ.
>
> > I don't believe you need all of these extra benefits or overhead.
> > Instead you could use a System.Collections.Generic.Queue<T> (http://
> > msdn.microsoft.com/en-us/library/7977ey2c.aspx). This provides the
> > same FIFO functionality without having to go outside of your
> > application.
>
> > On Sep 4, 2:48 am, CK <[EMAIL PROTECTED]> wrote:
>
> > > The efficieny depends on many factors - the size of your internet
> > > pipe, the size of the galleries etc.
>
> > > MSMQ will allow a First In First Out (FIFO) mechanism for processing
> > > your queue.
>
> > > Basically there are a million ways you can do this, try some out and
> > > come back if you have any issues.
>
> > > Thanks,
>
> > > Chris
>
> > > On 2 Sep, 11:52, Mark <[EMAIL PROTECTED]> wrote:
>
> > > > The user doesn't actually enter URLs of photos, but URLs of galleries
> > > > (or series of galleries)...and it's takes half a second to add them
> > > > (designed for ease of use)... so...the queue can get very large, very
> > > > fast. I know the code won't impose any limits on how many can be
> > > > asynchronously downloaded, but my question was more "is it efficient?"
> > > > -- ie, is it more efficient to download 10 photos, 2 at a time, or all
> > > > 10 photos at once? Maybe 2 at a time will achieve higher download
> > > > speeds and finish earlier? I assume IE and other browsers/programs
> > > > impose these limits for a reason.
>
> > > > No, I havent looked into MSMQ, I'll have a look at that later. Thanks!
>
> > > > On Sep 2, 1:06 am, CK <[EMAIL PROTECTED]> wrote:
>
> > > > > there is a limit in Internet Explorer, but using code you shouldn't
> > > > > have an issue.  How quickly will users be able to enter a new url
> > > > > compared to how quickly the pictures are downloaded?
>
> > > > > Have you looked into MSMQ - Microsoft Message Queue?
>
> > > > > On 1 Sep, 09:58, Mark <[EMAIL PROTECTED]> wrote:
>
> > > > > > Isn't there a cap on how many images you can download at once? Most
> > > > > > downloader/uploader programs only download/upload 2-8 files at a
> > > > > > time...any more than that is inefficient/eats all your bandwidth, 
> > > > > > no?
> > > > > > I would like to DL about 8 at a time, and queue the rest...
>
> > > > > > On Aug 20, 12:40 am, CK <[EMAIL PROTECTED]> wrote:
>
> > > > > > > Why build a listbox full of the items?
>
> > > > > > > I would write my method for downloading the images, then create a
> > > > > > > delegate with a matching signature.  Every time the user enters 
> > > > > > > text
> > > > > > > and clicks the button, call the delegate asynchronously, passing 
> > > > > > > in
> > > > > > > the string.  This means each image will be downloaded 
> > > > > > > asynchronously
> > > > > > > with no queuing mechanism required.
>
> > > > > > > On 19 Aug, 23:50, Mark <[EMAIL PROTECTED]> wrote:
>
> > > > > > > > I'm making a Windows Forms Application. It contains a ListView, 
> > > > > > > > a
> > > > > > > > TextBox and a Button. The user can type some stuff in the 
> > > > > > > > TextBox,
> > > > > > > > click the Button, and it will be added to the ListView. I want 
> > > > > > > > to
> > > > > > > > process the items in the ListView and then pop them off list, 
> > > > > > > > using a
> > > > > > > > separate thread, so that the program doesn't hang and the user 
> > > > > > > > can add
> > > > > > > > more items while it's running. With what I have right now, I 
> > > > > > > > can't
> > > > > > > > remove items from the list from a different thread. I 
> > > > > > > > understand why
> > > > > > > > this causes problems, but I'm not sure how to fix it. I've tried
> > > > > > > > following a few tutorials to use delegates, but I can't seem to 
> > > > > > > > get it
> > > > > > > > to work. Here's what I've got right now:
>
> > > > > > > > using System;
> > > > > > > > using System.Collections.Generic;
> > > > > > > > using System.ComponentModel;
> > > > > > > > using System.Data;
> > > > > > > > using System.Drawing;
> > > > > > > > using System.Text;
> > > > > > > > using System.Windows.Forms;
> > > > > > > > using System.Text.RegularExpressions;
> > > > > > > > using System.Threading;
>
> > > > > > > > namespace ImageDownloader
> > > > > > > > {
> > > > > > > >     public partial class Form1 : Form
> > > > > > > >     {
> > > > > > > >         public Form1()
> > > > > > > >         {
> > > > > > > >             InitializeComponent();
> > > > > > > >         }
>
> > > > > > > >         private void Download()
> > > > > > > >         {
> > > > > > > >             while (true)
> > > > > > > >             {
> > > > > > > >                 if (listView1.Items.Count > 0)
> > > > > > > >                 {
> > > > > > > >                     listView1.Items.RemoveAt(0);
> > > > > > > >                 }
> > > > > > > >             }
> > > > > > > >         }
>
> > > > > > > >         private void button1_Click(object sender, EventArgs e)
> > > > > > > >         {
> > > > > > > >            listView1.Items.Add(textBox1.Text);
> > > > > > > >            textBox1.Text = "";
> > > > > > > >         }
>
> > > > > > > >         private void Form1_Load(object sender, EventArgs e)
> > > > > > > >         {
> > > > > > > >             Thread t = new Thread(new ThreadStart(Download));
> > > > > > > >             t.Start();
> > > > > > > >         }
> > > > > > > >     }
>
> > > > > > > > }
>
> > > > > > > > This theoretically should just remove all the items from the 
> > > > > > > > list as
> > > > > > > > soon as they are added, one by one. Obviously I'll do some 
> > > > > > > > processing
> > > > > > > > on each item first, but I need to get this working before I get 
> > > > > > > > into
> > > > > > > > that :)
>
> > > > > > > > Thanks for any help.- Hide quoted text -
>
> > > > > > - Show quoted text -- Hide quoted text -
>
> > > > - Show quoted text -- Hide quoted text -
>
> > - Show quoted text -
>
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web 
Services,.NET Remoting" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://cm.megasolutions.net/forums/default.aspx
-~----------~----~----~----~------~----~------~--~---

Reply via email to