Click here to Skip to main content
15,896,487 members
Home / Discussions / C#
   

C#

 
AnswerRe: Serial interface RS-232 C# app data recive issue Pin
Richard Andrew x6431-May-10 11:14
professionalRichard Andrew x6431-May-10 11:14 
QuestionTime event? Real time data send Pin
sodevrom31-May-10 6:46
sodevrom31-May-10 6:46 
AnswerRe: Time event? Real time data send Pin
Luc Pattyn31-May-10 7:03
sitebuilderLuc Pattyn31-May-10 7:03 
GeneralRe: Time event? Real time data send Pin
sodevrom31-May-10 7:12
sodevrom31-May-10 7:12 
GeneralRe: Time event? Real time data send Pin
Luc Pattyn31-May-10 7:14
sitebuilderLuc Pattyn31-May-10 7:14 
GeneralRe: Time event? Real time data send Pin
sodevrom31-May-10 7:18
sodevrom31-May-10 7:18 
AnswerRe: Time event? Real time data send Pin
OriginalGriff31-May-10 9:59
mveOriginalGriff31-May-10 9:59 
AnswerRe: Time event? Real time data send Pin
Anthony Mushrow31-May-10 14:47
professionalAnthony Mushrow31-May-10 14:47 
It's true that while running through a loop constantly is not very efficient it is going to be the most accurate for you. What you really need to decide is how accurate you really need this to be.

You say that when you match up with one of the times you have you will send data to a TCP client, sending data over the network (unless the destination is actually your own machine) will have a small delay of some milliseconds to actually get sent and then it will be a little longer before it arrives at where it needs to be. That being the case you may be able to set up a standard System.Timers.Timer and use a reasonably small Tick (say 50 milliseconds or something).
All you'd need to do then is know the current time and check to see if there are any times in your list that you have gone past since the last time you checked. In this case there would be a maximum delay of 50ms since the time in your list but of course you could lower it for a little more accuracy (Keeping in mind that at the best of times the standard timer will only get called every 20ms) or indeed make the gap larger which would save some of your precious CPU time.

There's no way you're going be able to set up any kind of event that will be fired accurately down to the millisecond, even with a while loop and a performance counter it's easily possible that you may skip past a time (and therefore miss the event or fire it 'late'). So like I said you need to decide how much delay you can tolerate if the answer is 'None' then you will have to stick with your while loop because that is as accurate as it's going to get
My current favourite quote is: Punch them in the face, see what happens!
-SK Genius


AnswerRe: Time event? Real time data send Pin
Anthony Mushrow1-Jun-10 4:49
professionalAnthony Mushrow1-Jun-10 4:49 
Questionstyle button Pin
toba tavasoli31-May-10 5:09
toba tavasoli31-May-10 5:09 
AnswerRe: style button Pin
OriginalGriff31-May-10 5:12
mveOriginalGriff31-May-10 5:12 
AnswerRe: style button Pin
Abhinav S31-May-10 6:00
Abhinav S31-May-10 6:00 
AnswerRe: style button Pin
Smithers-Jones31-May-10 8:07
Smithers-Jones31-May-10 8:07 
QuestionSpeed Issue in POS Customer Display Pin
NetMan201231-May-10 4:34
NetMan201231-May-10 4:34 
AnswerRe: Speed Issue in POS Customer Display Pin
Luc Pattyn31-May-10 4:51
sitebuilderLuc Pattyn31-May-10 4:51 
AnswerRe: Speed Issue in POS Customer Display Pin
Alan Balkany1-Jun-10 3:50
Alan Balkany1-Jun-10 3:50 
Questionstringbuilder to string Pin
michaelgr131-May-10 1:22
michaelgr131-May-10 1:22 
AnswerRe: stringbuilder to string Pin
Rajeshwar Code- Developer31-May-10 1:31
Rajeshwar Code- Developer31-May-10 1:31 
GeneralRe: stringbuilder to string Pin
michaelgr131-May-10 1:32
michaelgr131-May-10 1:32 
GeneralRe: stringbuilder to string Pin
Not Active31-May-10 2:34
mentorNot Active31-May-10 2:34 
AnswerRe: stringbuilder to string Pin
Not Active31-May-10 2:35
mentorNot Active31-May-10 2:35 
GeneralRe: stringbuilder to string Pin
michaelgr131-May-10 2:46
michaelgr131-May-10 2:46 
AnswerRe: stringbuilder to string Pin
#realJSOP1-Jun-10 4:56
professional#realJSOP1-Jun-10 4:56 
QuestionDataAdaptor.Fill startRecord Pin
Eli Nurman31-May-10 1:18
Eli Nurman31-May-10 1:18 
AnswerRe: DataAdaptor.Fill startRecord Pin
Rajeshwar Code- Developer31-May-10 1:34
Rajeshwar Code- Developer31-May-10 1:34 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.