How to prevent other programs from connecting to the COM-port I'm using

25 Views Asked by At

I am using python pymodbus library to read data from a COM port. When launched, the program reads data on the COM port, but if I connect to the same port by some other program, it intercepts the port and the work of my program is interrupted. How can I solve this problem and let the computer know that the port I'm using is already taken and no other programs can connect to it. This is my connection:

client = ModbusClient(method='rtu', port=port, stopbits=2, bytesize=8, parity='N', baudrate=19200, timeout=1)
0

There are 0 best solutions below