I have a fairly complex application in Delphi 2006 that communicates through an ApdComport using a separate form in another thread. The communication used to fail quite a lot and I found a couple of calls to Application.Processmessages in the loops and reconstructed it using the ApdComport.ProcessCommunications instead.
I don't really want to rearrange the code to use event handlers instead at this point.
I also want to make the communication fast so I call ProcessCommunications until there is a CharReady. Sometimes ProcessCommunications raises an ECommNotOpen exception with the message "ie_NOpen - device not open". I've been unable to find info about this in the help or on the web.
I tried putting an ApdComport on a new form in a new project and call its ProcessCommunications frequently and could not get it to crash. It did not do any real communication though.
I have tried checking that the output buffer has enough free space before sending stuff but it always has and the problem is still there.
So what is happening? Where should I look and what can I do?