VaComm - COM Port disappeard on opening

Dear All, 


We use the VaComm component for a while to communicate with measurement devices plugged on COM port. 

We successfully use it for direct COM port or even for redirected COM port on terminal server. 

Recently, we encountered a problem for only one of our customer. He uses our application through Terminal server. So the COM Port are redirected through the RDP shortcut. 

I created a simple app to reproduce the problem. Here is the process : 

1. Connection to Terminal server with Port redirection activated.
2. on a CMD Prompt, execution of the following command : "change port /query" which list all the COM port recognised by the machine. 
Result is :  

AUX = \DosDevices\COM1
COM1 = \Device\RdpDrPort;COM1:1\tsclient\COM1

Which means that COM1 is the client COM port. 

3. Test the communication on COM1 with a test application --> Communication OK
4. Test the COM1 opening whith the following application

VaComm1.Close;
VaComm1.PortNum:=1;
VaComm1.Baudrate:=br9600;
VaComm1.Databits:=db8;
VaComm1.Parity:=paNone;
VaComm1.StopBits:=sb1;
VaComm1.Buffers.ReadSize:=4096;
VaComm1.Buffers.WriteSize:=4096;
VaComm1.FlowControl.ControlDTR:=dtrDisabled;
VaComm1.FlowControl.ControlRts:=rtsDisabled;
VaComm1.FlowControl.DsrSensitivity:=False;
VaComm1.FlowControl.OutCtsFlow:=False;
VaComm1.FlowControl.OutDsrFlow:=False;
VaComm1.Open;

--> The communication doesn't work and the worst is that if I re-excute the command prompt, the COM1 redirection line disappeard. It looks like the action to open the VaComm1 connection make the COM Port redirection to crash. 

I tested the same application directly on the client computer and the communication works so I don't think the problem is coming from the devices. 

Doesn anybody have ever had this kind of problem? Or do you have any idea of what I could do to correct it?

Thanks a lot for your help. 

Daniel Christe

This is the first time we hear about such issue.
What Windows version is this? What is the test application with which COM1 works ok? What happens when you start the test application multiple times?

Dear Bruno,. 


Thank you for your answer, 

I've never heard about this kind of problem niether and we have hundreds of people working with this solution, directly or through Terminal Server. 

It's a Windows 2012 Server working with ThinStuff Pro Terminal Server solution. 

The test application is called "MuxConf" it is delivered by the company "Metro" which developps the measurement device that we use. 

I can only start this application once. If I restart it, the system says that the COM1 doesn't exist. I need to restart the Terminal Server Session to be able to see the COM1 port again. 

I tried to flush buffers between the process, I tried to change COM Port number. 

I have no solution yet, still searching. 

Any idea?

Thanks

Daniel Christe

Assuming that the company producing the device also delivered the driver, I'd suggest to check first if you have the latest version of the driver and if this problem persists, contact this company.

Hi again, 


thank you for your answer, 

We tried to reinstall the latest version of the driver and still the same problem. 

We got more infomation though, 

The device is connected to the client computer through a USB/Serial adapter. Our customer is now checking if he find a computer with a direct COM Port on it, then we could see if the problem coms from the adapter. 

The Exact error is : 

- Directly after the first opening of the port : The redirection line dissapear from the mapping ports
- The first communication (Before the first closing of the port) is working. 
- If I Close the port and the reopen it, I got the following error message : "Can't open specified device \.\COMx (Error 5, Access is denied)"
- I can't communicate anymore
- If I close the TS session and then Reopen it , the first communication works and again, the following communication doens't work. 

I made some test with other kind of Com management components (TComPort). with the same configuration. The Port mapping is still dissapearing from the list (change port /query) but the communication is always working, even after I close and reopen it. 

But If I open the communication with VaComm and then close it, the Communication with TComPort also returns an access denied error and doesn't work anymore. 

So it looks like Com Port opening with VaComm locks the Com port and Com Closing of VaComm can't unlock it., 

Have you ever hear of something like that? Any idea?

I'll let you know the further results of our tests. 

Thanks

Daniel Christe.

It's the first time we receive this kind of feedback. Are you sure it's the same VaComm instance that opens it, also closes it?

Does this mean also that code like
VaComm.Open;
VaComm.Close;
VaComm.Open;
VaComm.Close;
fails?

What is the DeviceName PortNum is the difference?

DeviceName is default COM%d and this DeviceName setting is used together with PortNum to determine the full port name that will be used to open the serial device. I.e., if you set  PortNum = 3, then it will open serial device name : COM3