• Welcome to Forum.Deepsoftware.Com. Please login or sign up.
 

The some notes about OnAfterReceive event ...

Started by Roman Novgorodov, February 03, 2008, 03:36:42 am

Previous topic - Next topic

Roman Novgorodov

February 03, 2008, 03:36:42 am Last Edit: December 01, 2011, 08:34:00 am by Roman Novgorodov
If device sends the following two data packets:
"123456789" <timeout> "ABCDEFG"

You expect two calls of OnAfterReceive() event:

OnAfterReceive(, "123456789",9)
OnAfterReceive(,"ABCDEFG",7)

You are wrong!

Of course, it is possible, but it's not correct for all situations!!!

Please understand that raising AfterReceive event is depend on many factors like: power of your windows system, quality and speed of serial line, power of remote device, mutlithread blocking (critical section) and etc ...

The following calls are possible too !!!:

OnAfterReceive("12",2)
OnAfterReceive("3456789AB",9)
OnAfterReceive("CDE",3)
OnAfterReceive("FG",2)

Your OnAfterReceive handler should process this situations correctly.

There is another easy way to resolve this situation. You can use the TnrDataProcessor component for monitoring the incoming data stream. You can look at DataProc demo project.
DeepSoftware llc - The professional components for Delphi/CBuilder/.NET. The high quality custom software development.
Forums.nrCommLib.Com - DeepSoftware Tech Support Forum.