문제

I am trying to multi thread in serial ports. Say that I have X serial port. Each port has Y devices(modbus).I am taking out data from each device. To take out data from the device I need to send a message, then wait for the respond. I would like to speed up the application, that is why I would like to multi thread in it.

Is it possible to send and wait for multiple messages in one serial port?

Regards
Daniel

도움이 되었습니까?

해결책

No, it's not. The serial port doesn't orgainze the data in such a way. It just takes bytes in and allows you to take bytes out in a sequential manner. Attempting what you're asking will not work. You'll get garbled serial port data, if not outright errors. There's just no way to say "These bytes belong to that message".

Sorry, that's just the basic design of how they work.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top