Skip to content

Occasional Hangup with Serial Transport #182

@ramlco

Description

@ramlco

Hello,

I am experiencing an occasional hangup with my application. I am using the Windows Serial transport on the Client side and my own USB-CDC port on the Server side. Normally, when the Sever is sending a response to a Client request, I see the following:

  1. Sever sends a 4 byte header
  2. Client performs serial read, gets 4 bytes
  3. Server sends the message (16 bytes in this case)
  4. Client performs serial read, gets 16 bytes
  5. All is well, Client moves on

In the error state, I see this:

  1. Server sends a 4 byte header
  2. Server sends the message (16 bytes in this case)
  3. Client performs serial read, gets 20 bytes
  4. Client is now stuck in the 'serial_read' function because it read more than the 4 bytes is was expecting

To fix this, I would propose changing the 'nNumberOfBytesToRead' paremeter in the 'ReadFile' call to use the requested read size as a maximum rather than the Rx buffer size. Here is a screenshot of the fix (line 226):
image

Thanks in advance! This has been a great application to work with!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions