Solved

.Net void multi-threading

Posted on 2016-08-10
6
55 Views
Last Modified: 2016-08-10
I have a winforms app I inherited

In effect it opens with a task scheduler
Runs a sub (void) and closes

The SendMail void effectively sends 10,000 emails from a list it gets in SQL Server and send on to a providers smtp

That Provider allows 10,000 in a send....
But there can be multiple sends going on at the same time.

Is there a way to run the SendMail void in 5 separate "threads" so that 50k are being sent?

        SendMail(IsLive)
        Me.Close()
0
Comment
Question by:lrbrister
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 70

Accepted Solution

by:
Éric Moreau earned 500 total points
ID: 41750443
you can wrap your code in a task and create 5 of them. Check http://emoreau.com/Entries/Articles/2013/10/SystemThreadingTask-class.aspx

but are you sure your provider will allow you to send 50,000 emails at the same time?
0
 
LVL 10

Expert Comment

by:Paweł
ID: 41750456
a task scheduler? what version of .net are you using?
0
 

Author Comment

by:lrbrister
ID: 41750466
Eric,
  50,000 at the same time in a "timeframe"

Pawel
.Net 4.5
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 70

Expert Comment

by:Éric Moreau
ID: 41750481
you can try to wrap your code in task as shown by my article and launch your tasks
0
 

Author Closing Comment

by:lrbrister
ID: 41750482
Very nice
0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 41750484
or just launch your job from the task scheduler 5 times with a parameter to process a different set of records in each instance
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question