0

i want to detect/Configure serial port (COM Port) on which my device is connected automatically. Is it possible to do so in c#?

8
  • You have to detect COM number Commented Jul 20, 2014 at 12:16
  • thanks, yes but how do i do it programmatic automated ? I need to set Com port number, Boud rate n all things that I wanna detect programatically automated Commented Jul 20, 2014 at 12:18
  • Maybe this help Commented Jul 20, 2014 at 12:20
  • Nothing is "automatic" when you use serial ports. Dating from the stone-age of computing, they are not plug & play devices. You have to know the port number and the port settings, like baudrate, up front and they must exactly match the device settings. You typically need to provide the user with a configuration UI or file so they can match your program to the device. Commented Jul 20, 2014 at 12:32
  • Will the device respond automatically when connected? Commented Jul 20, 2014 at 14:18

1 Answer 1

2

What exactly you like to do? Did you look at Properties and Methods in System.IO.Ports class?

Following MSDN article may help.

http://msdn.microsoft.com/en-us/library/system.io.ports.serialport(v=vs.110).aspx

Sign up to request clarification or add additional context in comments.

2 Comments

I am going to read data from serial port given by my electronic device which i am going to connect. But i need to configure each time manually within my program. I got all config details from system.IO.Ports but i am not getting automate config...
You must convert your app as multi threaded and a function which runs in background thread, and poll all the com ports in the system and try to open and handshake each. What ever port open successfully with out timeout, and able to handshake with you, it is the port you are interested and device connected to it. Then you can raise an event, from this background function which is nothing but the autodetect.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.