We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now

x

How to get com status?

predator1
predator1 asked
on
Medium Priority
183 Views
Last Modified: 2010-05-18
I want to be able to find out whether the com port has a valid dial tone
or not and also to distinguish between open port and a intermittent dial
tone.

Hope someone can help.
Thanks
Derek
Comment
Watch Question

Commented:
First you have to know what is attached to your com port, if it is a modem then you have to know how to communicate with the modem. In your case, you have to know what sort of signal is received by the modem, and if the modem can recognise different line sets.
As far as the communication port, you can know if the port itself is open or not by querying the PortOpen property, if it returns True than it is open and so forth.
One more useful thing is the Comm Event in MSCOMM, OnComm example:
Private Sub MSComm_OnComm ()
      Select Case MSComm1.CommEvent
      ' Handle each event or error by placing
      ' code below each case statement

      ' Errors
            Case comEventBreak      ' A Break was received.
            Case comEventCDTO      ' CD (RLSD) Timeout.
            Case comEventCTSTO      ' CTS Timeout.
            Case comEventDSRTO      ' DSR Timeout.
            Case comEventFrame      ' Framing Error
            Case comEventOverrun      ' Data Lost.
            Case comEventRxOver      ' Receive buffer overflow.
            Case comEventRxParity      ' Parity Error.

Case comEventTxFull      ' Transmit buffer full.
            Case comEventDCB      ' Unexpected error retrieving DCB]

      ' Events
            Case comEvCD      ' Change in the CD line.
            Case comEvCTS      ' Change in the CTS line.
            Case comEvDSR      ' Change in the DSR line.
            Case comEvRing      ' Change in the Ring Indicator.
            Case comEvReceive      ' Received RThreshold # of
                                                ' chars.
            Case comEvSend      ' There are SThreshold number of
                                          ' characters in the transmit
                                          ' buffer.

Case comEvEof      ' An EOF charater was found in                                                 ' the input stream
      End Select
End Sub

You can access this sub by double clicking on the MSCOMM icon.
This sub will tell what is happening with Communication port every time you use it or when an error occurs.
Hope that will get you started.

Commented:
One more thing you can check the eventsunder the MSComm_OnComm events, you may detect what sort of signal you have.

Author

Commented:
I tried most of that already, and it doesn't seem to do what i want.
I will expand a bit,
I don't want to do any dialing.
we have a service here called "Call Answer", it is basically voice mail. When there are new messages waiting, i get a intermittent dial tone, and therefore the modem doesn't recognize that as the proper dial tone. in dun, it will tell me there is no dial tone.
I just want to have the program always checking the modem com port to check the status and only tell me when there is the intermittent dial tone there.

hope this is more clear.

Commented:
In my opinion, Commport command can not help you in identifying the intermittent dial tone (which is at different Decibles and Hz of the normal one). Your modem hardware/software manual may be of more help to you to identify the intermittent dial tone.
Every modem has different commands,  settings, and capabilities. You may have to consider these in trying to check for intermittent dial tone.
Regards
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION

Commented:
I answered without seeing your further comments & K's reply. I will agree with K.  There is no way to check for the intermittent tone... The best test I can think of is just to attempt to dial and monitor for success or failure.

Author

Commented:
But every com app I've ever tried has always told there is no dial tone when I have that intermittent signal, and b4 dialing. It is similar to a busy signal, but it is not recognized as such by the modem. Can you pin point the call that checks for a dial tone? The only thing i can compare this to, is if you unhook one of ur phones and then try to dial out. I think u will get a "no dial tone" message. I just want to duplicate this but with a different message. The vb help isn't very good on this and i've tried searching for stuff with no luck either.

Commented:
predator1
As I said, ComPort can not detect the dial tone. Some modems has the capabilities to do that, and the complexity of doing so is solely dependent on the modem manual.
Regards

Author

Commented:
ok, i'm sorry to beat a dead horse and all your help is appreciated, but to me that just does not make sense. If only certain modems have this capability, people that dial out with no dial tone must get pretty pissed off when they sit there for a while and finally figure  out there is no dial tone.
I guess i will try sending a command to dial and see what i get back with my intermittent dial tone.

Thanks

Commented:
khaldec is shooting straight.  ALL modems will detect connection or failed connection.  That is their primary purpose in life outside of exchanging data.  True: if the line is physically disconnected the modem will not dial; it can't and it will report same, but outside of that this detection is still only made by an attempt to USE the line!
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.