Trigger for the first time to receive the correct data, the second is "", namely the count=0; Have bosses encountered such a problem, I send and receive hexadecimal all use
CodePudding user response:
Stick the data package PC program is generally true 1. A serial port/network receives data to make one thing: in the cache 2. Data unpacking, detection: baotou, length... Check, check to ensure that a complete package received, will be a complete package of data into another cache 3. The cached data packets unpacking 4. Through multiple threads or thread pool to start the business logic
CodePudding user response:
https://docs.microsoft.com/zh-cn/dotnet/api/system.io.ports.serialport.datareceived? View=dotnet - platt - ext - 5.0 See comments