Author Topic: The some notes about OnAfterReceive event ...  (Read 3257 times)

Roman Novgorodov

  • Engineer
  • Administrator
  • Hero Member
  • *****
  • Posts: 994
  • we will win
    • View Profile
    • Forums.nrCommLib.Com
The some notes about OnAfterReceive event ...
« on: February 03, 2008, 05:36:42 am »
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.
« Last Edit: December 01, 2011, 10:34:00 am by Roman Novgorodov »
DeepSoftware llc - The professional components for Delphi/CBuilder/.NET. The high quality custom software development.
Forums.nrCommLib.Com - DeepSoftware Tech Support Forum.