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



The information in this article applies to:

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

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.

Modification Type:MajorLast Reviewed:5/13/2003
Keywords:kb3rdparty kbCommPort kbprb KB318784