handle same com port over 2 apps

How to handle the same com port over 2 separate apps

eg. "Sales" program using serial port "com 4"
and "Product" program also using serial port "com 4"

So ideally I want to have control and use  "com 4"  but from 2 separate apps/exes on same computer.

Is this possible? Then how ?

regards

Kamran



 

By design, in Windows, a serial port can only be opened once. It is an exclusive operating system resource. So, two apps cannot open the same COM port. If you want to use a COM port from 2 apps, you'd need to write some middle-ware that exclusively opens this COM port and then mediates between the two applications to share this resource.