I'm working on sending datas via COM in C++ for ESPA 4.4.4. A program B connected on a COM port normally detects if the program A sends datas. To test this I have created two virtual ports pair with com0com, COM1/CNCB1, COM2/CNCB2. With hub4com I connected like explained here
But when I try to connect to COM1 or COM2 with A or B, it cannot be done because the port is already in use.
SO my problem is that I want the two ports to communicate. -> First question: is the architecture in the tutorial good to deal with. I mean is it ok to deal with COM1/CNCB1 and COM2/CNCB2? -> Second question: the command to connect the two ports is "hub4com options \.\input_COM \.\output_COM1" \.\output_COM2"... SO I tried to do: "hub4com -baud=9600 \.\COM1 \.\COM2". The command is valid and I get the following return:
Open("\\.\COM1", baud=9600, data=8, parity=no, stop=1, octs=off, odsr=off, ox=off, ix=off, idsr=off, ito=0) - OK
Open("\\.\COM2", baud=9600, data=8, parity=no, stop=1, octs=off, odsr=off, ox=off, ix=off, idsr=off, ito=0) - OK
Route data COM1(0) --> COM2(1)
Route data COM2(1) --> COM1(0)
Route flow control COM1(0) --> COM2(1)
Route flow control COM2(1) --> COM1(0)
Started COM1(0)
Started COM2(1)
So the road is established and the datas should communicate. But I can't connect on the COM ports with my programs. So I tried to connect on CNCB1 and CNCB2 instead. I can connect on the COM ports. But I don't know if the data have arrived.
-> So third question: is there a reliable way to know if COM1 sends datas to COM2? Just a little software would be great, to test the architecture
It should be fine, they're just names. If you're going to have a man in the middle type of application, you'd want the data to flow like... (ProgramA -> COM1 -> CNCB1 -> ProgramB -> COM2 -> CNCB2 -> Destination.) So ProgramB should have ports open for both CNCB1 and COM2.
I'm not too familiar with hub4com to give you an answer for that. It sounds like hub4com is opening the ports up and your application is also trying to open the port up. Only one application can have access to a port.
Sounds like you need a port monitor. http://technet.microsoft.com/en-us/sysinternals/bb896644.aspx