473,382 Members | 1,302 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

How to know a COM port is a modem

Hello everybody,
in my application I'd need to know if a com port is a modem or not (and
eventually its description and if it is a null modem).
I get the list of com ports available with:
string[] portList = System.IO.Ports.SerialPort.GetPortNames();
and then i set a port object like this:
System.IO.Ports.SerialPort sPort = new
System.IO.Ports.SerialPort(portList[i]);
Is there some property of the serial port who tells me indirectly it is
a modem? As i said, I'd also need to get the modem description, and the
information about it being a null modem, a modem on a physical port or a
modem on a virtual usb com port (and i can't read the registry because
my application has to run also under Vista).
Any help would be appreciated, thank you.
Alberto
May 22 '07 #1
3 6424
On Tue, 22 May 2007 02:47:06 -0700, Nutshell <al****@hotmail.comwrote:
Hello everybody,
in my application I'd need to know if a com port is a modem or not (and
eventually its description and if it is a null modem).
Short of getting access to Windows' own list of known modems and
cross-referencing that with the list of COM ports, I don't see how you'd
be able to do this directly. That's sort of the point of the serial port,
is that anything could be connected to it. I wouldn't expect there to be
any sort of property associated with it that says "I have a modem
attached".

I don't know enough about Vista to understand why you can't get access to
the registry to get the information about modems from the Windows' data.
It seems to me that if a user can get access to the modems through the UI
somehow, then they must have read access to that portion of the registry
somehow. But I admit I have very little first-hand experience with Vista
so far. If you are sure that even when you make sure you don't try to
open the registry with write access, you still can't get at the data, I'll
take your word for it.

And assuming you can't look at the registry, AFAIK the only way to do it
is to try sending data to the modem and see what happens. For example,
send an appropriate "AT" command to get the modem status and see what
comes back (if anything). Of course, if there's something attached to the
serial port that's NOT a modem, that might not be the nicest thing to do.
:)

Pete
May 22 '07 #2
Peter Duniho ha scritto:
And assuming you can't look at the registry, AFAIK the only way to do it
is to try sending data to the modem and see what happens. For example,
send an appropriate "AT" command to get the modem status and see what
comes back (if anything). Of course, if there's something attached to
the serial port that's NOT a modem, that might not be the nicest thing
to do. :)
I can't try to open all available ports since they could be in use by
another processes, but I think I found another way to do it, if it works
i'll post it.
May 23 '07 #3
On Tue, 22 May 2007 23:41:57 -0700, Nutshell <al****@hotmail.comwrote:
I can't try to open all available ports since they could be in use by
another processes,
Yup. As I alluded to, directly querying the ports is not necessarily the
best solution.
but I think I found another way to do it, if it works i'll post it.
Man, what a tease. Not even a little hint as to what you're trying? :)

Pete

May 23 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: David | last post by:
hi i try to connect to my site on port 80 from my local network no probleme but from outside is do not work like no site a this address ! my firewall is redirect port 80 on my local IP (the...
3
by: MLH | last post by:
I found some code Dev Ashish posted nearly a decade ago in response to someone's inquiry describing their need to dial a number, monitor call progress and determine whether it was busy. This was...
6
by: John J. Hughes II | last post by:
My code starts a TCP/IP socket listener and waits for incoming connections. This works fine on my system and my test system but I have a customer who say it does not work on their system. As far...
1
by: Mark Smith | last post by:
Hello Group, I am using the RASAPI to dial-to the internet using a GPRS modem using C#. Is it possible before dialling to retreive information about the COM port that the modem is connected...
0
by: Mark Smith | last post by:
Hello Group, I am using the RASAPI to dial-to the internet using a GPRS modem using C#. Is it possible before dialling to retreive information about the COM port that the modem is connected...
0
by: Mark Smith | last post by:
Hello Group, I am using the RAS API to dial-to the internet using a GPRS modem using C#. Is it possible before dialling to retreive information about the COM port that the modem is connected...
3
by: Essam | last post by:
Hi All I have two programs ; both of them I need to give read/write access to the same Comm Port. How can I do so; using Code or third party tool/library
3
by: David W. Rogers | last post by:
I am trying to use the software from John Hind's article: "Use P/Invoke to Develop a .NET Base Class Library for Serial Device Communications". When I use my application, everything works fine. I...
0
by: Uncle Leo | last post by:
Hi, I've written an application that uses a TcpClient to listen on a port. Clients on other computers can then connect and start talking to each other. The TcpClient listens on port 47141....
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.