Forum Index > EOF Event in OnComm Event

By: Dara Hayes Posted on: Apr 23 2013 at 12:13:19 PM
I am evaluating the COMM64.DLL , I have pic in a box sending Hex 7F (127) as end of its message from the box
I set the EOf-event on for the Comm1 device and set the EOF value to 127 but despite setting RThreshold to zero to prevent any reads of the buffer, I don't get the event fired at all , but when I do some reads in the OncOmm char received event with RTthreshold set to 1 then I do get the EOF event firing every end of message , but of course there is nothing in the receive buffer so I have lost my message , how to I get round this and fire the event to read my full message on EOF event
what am I doing wrong to correctly fire this EOF event when I want it at EOF char received ,.. thanks in advance for your help on this matter !

By: Guest Posted on: Apr 23 2013 at 01:00:40 PM
As explained in the documentation (EOFEnable) - the EOF event is triggered

When - in other words 'after' - the EOF char is read from the buffer.

That's not what you're expecting but you can do what you want by buffering RX data within your application.

So, set rThreshold to 1 and each time the evReceive event is triggered read data out of the buffer and append it in a string buffer within your application. Don't bother inspecting your string buffer yet. When you eventually get the EOF event it does not mean that EOF exists in the rx buffer. It means that you already read EOF and now you can inspect/process your local/stringbuffer knowing that it contains EOF.

The above behaviour, by the way, is the same as MSComm32

By: Guest Posted on: Apr 23 2013 at 01:08:24 PM
Take a look at the EOF properties of the comm32 OCX at

It's a different component but has the same functionality and the EOF property is better documented.

By: Dara Hayes Posted on: Apr 25 2013 at 04:33:49 AM
Thans for both of these replies I have it working now thanks


Reply - add comment to this topic
You may enter letters, numbers and standard punctuation only. HTML and other scripts/tags will be rejected
  Topic:- EOF Event in OnComm Event

Your Name


Forum scripts and databases - Copyright (c) 2009 - 2012