Microsoft KB Archive/318784

From BetaArchive Wiki
Knowledge Base


PRB: MSComm.Input Returns comReadError (8020) with Some Serial Ports

Article ID: 318784

Article Last Modified on 5/13/2003



APPLIES TO

  • Microsoft Visual Basic 6.0 Enterprise Edition
  • Microsoft Visual Basic 6.0 Learning Edition
  • Microsoft Visual Basic 6.0 Professional Edition



This article was previously published under Q318784

SYMPTOMS

When you use the Input method of the MSComm control with some serial ports, the MSComm.Input method may fail, and you may receive the comReadError error (error 8020).

CAUSE

This problem occurs because MSComm.Input reads only the bytes that are immediately available in the serial driver. By design, MSComm.Input does not return any bytes if the serial driver has not received any bytes. Because the MSComm control does not expect the ReadFile method to return ERROR_IO_PENDING, MSComm returns the comReadError error if this occurs.

RESOLUTION

A serial driver should return SUCCESS synchronously for all read requests that can be immediately fulfilled with data that is currently present.

This problem is only known to occur with some third-party serial drivers. To correct the problem, contact the manufacturer of the serial driver to obtain an updated driver.


Additional query words: MSCOMM32.OCX error reading comm device

Keywords: kbcommport kbprb kb3rdparty KB318784