Monitoring a COM port that is already in use

Can I read from a COM port that is already used in Windows XP?

I would like to see a connection between some software and a device connected to a serial device. I wrote a small program that uses C # to monitor COM, but as soon as it is used by another device, it will not let you open it again. How can I control a COM port that is already in use?

I am open to third-party software.

+4
source share
4 answers

Yes, it is technically possible. You will need a filter driver, a type of device driver that implements itself in front of a native serial port driver. It gets a crack in the IRP driver before sending them to a regular driver.

This is the method used by the PortMon SysInternals utility. However, you cannot write such a driver in C # code, the CLR cannot be loaded into ring 0. At least until the super-secret Midori project sees the light of day.

COM filter drivers are pretty common, like this one . You have to do some searches to find one that has a .NET shell.

+8
source

PortMon is a classic COM port monitor. It must be started before the program opens the COM port, but part of the monitoring can be enabled / disabled.

+6
source

You can use Portmon for Windows to track activity. In another way, I do it with the help of some equipment and a laptop. I'm not sure how you can control it with a C # application. As soon as you connect to it and try to connect again, it will already be used.

Also check this, it is somewhat related to the entry on how PortMon works:
Serial Port Forwarding or Splitting - Stack Overflow

If you have or may have more than one COM port, you can use the splitter and monitor from another port.

+2
source

com0com can meet your needs. It worked for me.

+2
source

Source: https://habr.com/ru/post/1309994/


All Articles