LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Reading Comport Write port

I am creating a program to monitor a second programs comport communication.  How do I read data from the write buffer and also is there anything I need to do to connect to the comport while a second program is connected to the same port, I'm assuming that OpenCom needs to be used in order to use the other built in functions, but do not want to use it because it closes the port and then opens it if the port is open.
0 Kudos
Message 1 of 2
(3,202 Views)

In general you can not have a single serial port accessed by two different programs when calling OpenCom().  Concurrent access by multiple programs is not a supported feature.  Most serial sniffer programs work by replacing the serial port driver with something that does allow access.  If you need to monitor a serial port you have a few options:

Use a serial port monitor/sniffer program.

Create a DLL to replace the Comm interface library the application uses and implement each Comm function yourself with the hooks to allow monitoring of the send and receive buffers.  This would require linking your DLL into the application to over ride the existing serial interface calls.

Use another pair of serial ports to implement your own serial monitor.  This is a very simple way to monitor a serial application.  You simply route the serial interface cable through the hardware of two additional serial ports, which can be on the same PC or another system.  You set the two serial ports up as a data pass through pipe.  What comes in one goes out the other.  Since you are handling these ports with your own sniffer application you have full access and control over the data flow.

 

Message 2 of 2
(3,189 Views)