Click here to Skip to main content
15,901,001 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have developed and executed serial port communication in C#, dot net.

My code is working fine with all serial ports in the lap, Unless I connect dongle (TATA PHOTON) and disconnect it. Then if I execute my serial port code I am receiving exception as "Access denied" Kindly advise on this. Dongle is disconnected properly. Thanks in advance.
Posted

1 solution

Check your code: the chances are it hasn't noticed the disconnect, and has left the SerialPort instance open. If you do that, trying to connect a new one will fail because the port is in use.

Make sure that when it disconnects, you close and dispose any existing instances.
 
Share this answer
 
Comments
Member 11815444 6-Jul-15 2:11am    
I am using both close as well as dispose.. and also checking the condition if connection is open ..closing it and then opening it again..then also same exception..Plz advise

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900