itas109 / CSerialPort

CSerialPort - lightweight cross-platform serial port library for C++/C/C#/Java/Python/Node.js/Electron
https://blog.csdn.net/itas109/article/details/84282860
Other
740 stars 338 forks source link

Is there a way to know if an open port is diconnected #91

Closed Risu-swift closed 3 months ago

Risu-swift commented 3 months ago

I want to know if there is a way to identify if an open port is disconnected and reopen the port if it is available again.

Currently the method I thought I will use is CSerialPortInfo to check if the port exists and close the port if it doesnt and reopen the port once the port is available

My question is there any better way to do this ?

itas109 commented 3 months ago

This project may help on windows.

https://github.com/itas109/CSerialPortExtend/tree/master/hotSwap

Risu-swift commented 3 months ago

Thank you. I think that will work