Solved

Knowing if have access to "Net" via Cable Modem?

Posted on 1999-01-17
6
182 Views
Last Modified: 2013-11-13
I have set a feature in my program that uses the Winsock control to be able to reconnect to the internet if disconnected. This is for a DUN (Dialup network) connection. How i do this is by a timer which fires every 30 secs to check if the DUN connection is still established.
This works fine BUT if the user has a Cable Modem it the program will think that since it is not connected via DUN that it is not connected to the net, however, with a cable modem you are always connected to the internet. Is there a check i can do to see if the user has ANY kind of internet connection (besides DUN) and if he/she does and the connection is lost i want to be able to pop up an error message indicating connection was lost.  Thanks
0
Comment
Question by:ljaques
[X]
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
6 Comments
 
LVL 1

Expert Comment

by:carlosvs
ID: 1469103
How can you check the DUN?
0
 

Author Comment

by:ljaques
ID: 1469104
Carlosvs:
Leave me your email address here and i will send you my code on how to do this..Example and all.

0
 
LVL 2

Expert Comment

by:PedroG
ID: 1469105
i gues not!! i've were searching for something like that, and found no way to do it.
0
Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

 

Author Comment

by:ljaques
ID: 1469106
PedroG,
  I was goofing around and i notice that if you set a timer control to check every 30 secs at the Winsock1.LocalIP address you can see that the address is not "127.0.0.1" or "" and if it is not then that means you are connected to some network (hopefully the internet). If connection is lost then the LocalIP auto goes back to "127.0.0.1" or "".  Maybe this is a fluke accident but it seems to work for me right now
0
 
LVL 1

Expert Comment

by:carlosvs
ID: 1469107
It will be very usefull my email is
al532527@campus.sin.itesm.mx
thanks.
0
 

Accepted Solution

by:
BoHey earned 20 total points
ID: 1469108
Try this:

In Form/Standard Module:
----------------------------------------------------------------
Option Explicit

Private Const INTERNET_CONNECTION_MODEM = 1
Private Const INTERNET_CONNECTION_LAN = 2
Private Const INTERNET_CONNECTION_PROXY = 4
Private Const INTERNET_CONNECTION_MODEM_BUSY = 8

Declare Function InternetGetConnectedState Lib "wininet.dll" _
                 (lpdwFlags As Long, _
                  ByVal dwReserved As Long) _
                 As Boolean

Function call:
----------------------------------------------------------------
Private Sub cmdGetConnectState_Click()
 Dim bConnected As Boolean
 Dim lConDescr As Long
 
 bConnected = InternetGetConnectedState(lConDescr, 0&)
   
 If bConnected Then
  Select Case lConDescr
   Case lConDescr And INTERNET_CONNECTION_MODEM
    Debug.Print "InetConnect via Modem"
   Case lConDescr And INTERNET_CONNECTION_LAN
    Debug.Print "InetConnect via Lan"
   Case lConDescr And INTERNET_CONNECTION_PROXY
    Debug.Print "InetConnect via Proxy"
   Case lConDescr And INTERNET_CONNECTION_MODEM_BUSY
    Debug.Print "Modem busy"
   Case Else
    'Void...
   End Select
  Else
   Debug.Print "No Connection."
  End If
End Sub

0

Featured Post

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!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Problem to error 4 83
Problem to open text file 11 147
VB6 common control 6 sp6 object library not registerd 3 65
can this macro be converted to sub procedure 4 34
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 …
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

710 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