Home > Back-end >  API dual serial port receiving data is truncated and crash problems
API dual serial port receiving data is truncated and crash problems

Time:10-16

The code in this post, having over 100 points are scattered, and solve
http://bbs.csdn.net/topics/390606033
Send 2 command receiving plate is PC, the board response corresponding to each instruction after every 0.5 ~ 1 s (500 ms to 1000 ms) returns a set of data, each group of data is less than 4500 bytes
There is a problem:
1. Data truncation, frame header is aa, 44, 12 at the beginning, but always collection is not complete, half received data, added in dwRes1=WaitForSingleObject (Eol1 hEvent, 500); Added Sleep (100); Statements, slightly better, but there are still problems
2. The crash, in two ways:
1) setting button crashed and a serial port when see BBS, someone says, "is the AddString use SendMessage, need to wait for the main thread processing, but the main thread is WaitForSingleObject, so they crashed" don't know if this reason, how to solve the
2) accept return instruction data, often is returned in less than 10 sets of data card died, and this is what reason,

Ask Daniel directions

CodePudding user response:

Why nobody reply ah,,,,

CodePudding user response:

The buffer is not big enough?
  • Related