Check for actual COM port device connectivity

Posted on 2008-09-29
Medium Priority
Last Modified: 2013-12-26

Does anyone know a way to test to see if a device is actually connected to a given COM port?
The following code will return OK, as the port is open, but I need to know if a device is actually plugged in, not just an open port.


    If MSComm1.PortOpen = True Then
        MSComm1.Output = "e"
        MsgBox "Com port is not open...", vbExclamation, "Error"
    End If
Question by:tvtech
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
LVL 17

Expert Comment

ID: 22603319
Your device should have a functionality like Pinging, you need to send a Ping request and if you received answer it means device is connected, no other method is available. With MSCOMM you can only understand if port is open or not.


Author Comment

ID: 22603448
CSecurity, thanks, but no, there won't be any pinging, as the serial device is a trigger from a camera. It is totally passive, unless the camera is connected, however, the serial port does see the trigger device when it's connected to the port.
LVL 17

Expert Comment

ID: 22603468
So when device connects, it sends some data to COM Port, you need to open and look for that data, if any data came through COM port, it means device is connected
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Author Comment

ID: 22603491
Sorry, this is a bit hard to explain  ... the device is totally passive, unless the camera is plugged into it and is triggered by a foot switch. As the people who setup the device will not actually be using the camera, there is no way to get them to confirm anything.

I need a way to auto-detect the actual existence of the device (With, or without the camera being plugged in) just by plugging it into the serial port.
LVL 17

Accepted Solution

CSecurity earned 1400 total points
ID: 22603503
It's not possible, look at here:

Your device should send signals to make you able detect it in PC

Author Comment

ID: 22699786
Actually, yes it is possible. Thanks anyway.

Author Comment

ID: 23765919
Moderator, please delete this question, as I found the answer elsewhere.


Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question