Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / June 2007

Tip: Looking for answers? Try searching our database.

Background Timer Execution?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
lucius - 21 Jun 2007 19:41 GMT
I am looking for sample code of a C# 2.0 Service that every 1 minute
executes a method (that returns void). The timer and timer-fired
method need to be fully async and background so the main service does
not appear unresponsive. Can anyone show code like that? Small and
simple is best.

Thanks.
Peter Duniho - 21 Jun 2007 19:47 GMT
> I am looking for sample code of a C# 2.0 Service that every 1 minute
> executes a method (that returns void). The timer and timer-fired
> method need to be fully async and background

See the System.Threading.Timer class.
Chris Mullins [MVP] - 21 Jun 2007 21:43 GMT
[Snip all context]

Alright, now listen here!

That's like 10 times now I've gone to reply to a post, only to see you've
beaten me to it! I'm beginning to feel like a thread stalker. First it was
the Skeet character, then that Willy Coyote guy, and now you!

I'm afraid you're just going to have to stop that, as I need to have the
first crack at all questions.

From here forward, I'll be sure to post a "Go Ahead
[Peter|Jon|Willy|William]" message in each thread once I'm done with it,
indicating you can now post....

(If, somehow, my humor didn't come across, either my writing is much worse
than I think it is, or whoever is reading this is very humor impared....)

Signature

Chris Mullins, MCSD.NET, MCPD:Enterprise, Microsoft C# MVP
http://www.coversant.com/blogs/cmullins

Peter Duniho - 21 Jun 2007 22:02 GMT
> Alright, now listen here!
>
> That's like 10 times now I've gone to reply to a post, only to see you've
> beaten me to it! I'm beginning to feel like a thread stalker. First it  
> was
> the Skeet character, then that Willy Coyote guy, and now you!

Oops...the jig is up.  You've found me out!

I guess I'll have to sneak back in and take the hidden camera out of your  
office.  You know, the one I use to watch when you are composing a reply  
to a post, so that I can jump in and beat you to it.  Yes, that one.  :)

If it makes you feel better, I still think your article on the use of .NET  
Sockets is one of the best things I've come across in this newsgroup, and  
alongside all the prepared answer articles Jon's got, as well as any  
number of other well-informed replies from the usual suspects, that's  
saying something.

Besides, I just take the easy ones.  :)

Pete
Chris Mullins [MVP] - 21 Jun 2007 22:17 GMT
> Oops...the jig is up.  You've found me out!
>
> I guess I'll have to sneak back in and take the hidden camera out of your
> office.  You know, the one I use to watch when you are composing a reply
> to a post, so that I can jump in and beat you to it.  Yes, that one.  :)

Ironically, we deal with companies doing coordination of security cameras
(like wilife.com) via XMPP. As a result there are few "disconnected' video
cameras scattered around the office. I think I'll check on those...

> If it makes you feel better, I still think your article on the use of .NET
> Sockets is one of the best things I've come across in this newsgroup, and
> alongside all the prepared answer articles Jon's got, as well as any
> number of other well-informed replies from the usual suspects, that's
> saying something.

Aw man, flattery will get you everywhere.

What's amazing to me, is often I'll be looking for something crazy
specialized and specific on the web ("How do I ...?") and the frequency with
which I get Jon's or Willy's answers (and, to my surprise, my own!) is just
scary.

> Besides, I just take the easy ones.  :)

That's what I'm trying to do! I leave the hard ones for the smart people.

Signature

Chris Mullins, MCSD.NET, MCPD:Enterprise, Microsoft C# MVP
http://www.coversant.com/blogs/cmullins

Jon Skeet [C# MVP] - 21 Jun 2007 22:58 GMT
> That's like 10 times now I've gone to reply to a post, only to see you've
> beaten me to it! I'm beginning to feel like a thread stalker. First it was
> the Skeet character, then that Willy Coyote guy, and now you!

Pah - you think you've got it bad? Marc Gravell keeps replying to posts
and referencing classes in my MiscUtil library which I didn't even
remember I'd written. How's that for humiliating?

Signature

Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet   Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too

Chris Mullins [MVP] - 21 Jun 2007 23:30 GMT
>> That's like 10 times now I've gone to reply to a post, only to see you've
>> beaten me to it! I'm beginning to feel like a thread stalker. First it
[quoted text clipped - 4 lines]
> and referencing classes in my MiscUtil library which I didn't even
> remember I'd written. How's that for humiliating?

I've always enjoyed finding a piece of code that does exactly what I want,
looking at it, and going, "Wow. Whoever wrote this knew their stuff - one
day, hopefully, I'll be that good!". Then, as I keep reading, I find I'm the
author. I try hard not to interpret it as, "Your best days are behind you,
and dementia has set it.".

It's happened to me a number of times now when I'm looking for some very
specific Unicode Stuff (StringPrep related), or Async Socket / Thread code
snippets.

It's really amazing how, as soon as you get "uninvolved" with some of these
very, very specialized topics, the detailed knowledge just disappears. For
example, at one time I understood that UTF-32 encoding class you put
together for me (about 4 years ago, now). If I look at it now, it's all
gobbledegook. Another example - at one time I understood how COM Interop,
Win32 Interop, Marshalling, COM Callable Wrappers, COM+ and Thread Apartment
states worked. Now?  Pfffft.

Signature

Chris Mullins, MCSD.NET, MCPD:Enterprise, Microsoft C# MVP
http://www.coversant.com/blogs/cmullins

Jon Skeet [C# MVP] - 22 Jun 2007 00:00 GMT
<snip>

> It's really amazing how, as soon as you get "uninvolved" with some of these
> very, very specialized topics, the detailed knowledge just disappears. For
> example, at one time I understood that UTF-32 encoding class you put
> together for me (about 4 years ago, now).

Gosh - I'd completely forgotten it was for you. I remember the day
itself though very clearly. It was a beautiful day, and we were sitting
outside in the garden, with guests. But the coding was too fun :)

I hope you didn't use the class though - as it was, there were bugs in
it which would have come out very quickly. Now that I've started adding
unit tests for my MiscUtil class, I hope the quality is improving, but
I apologise for any errors that cruddy code caused...

On your more general point though, I quite agree. There's just too much
you need to be good at to really keep being good at everything the
whole time (at least if you're a normal, sane human being rather than
Don Box).

Signature

Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet   Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too

Jeffrey Tan[MSFT] - 22 Jun 2007 09:02 GMT
Hi Lucius,

Yes, just as Peter pointed out, you may use System.Threading.Timer for this
task. You may refer to the articles below for more details of 3 timer
classes in .Net Framework and their usages:
"Comparing the Timer Classes in the .NET Framework Class Library"
http://msdn.microsoft.com/msdnmag/issues/04/02/TimersinNET/

If you still have anything unclear, please feel free to feedback, thanks.

Best regards,
Jeffrey Tan
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
lucius - 26 Jun 2007 15:33 GMT
Thanks, problem solved.
Jeffrey Tan[MSFT] - 27 Jun 2007 03:06 GMT
Hi Lucius,

Thank you for the confirmation.

Ok, if you need further help, please feel free to post, thanks.

Best regards,
Jeffrey Tan
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
Jeffrey Tan[MSFT] - 26 Jun 2007 06:52 GMT
Hi Lcius,

Have you reviewed our replies to you? How about your issue now? If you
still need any help or have any concern, please feel free to feedback,
thanks.

Best regards,
Jeffrey Tan
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.