Solved

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

Posted on 1999-01-17
6
177 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
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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
count8 challlenge 13 85
firstChar challenge 13 83
Adding to a VBA? 6 46
Access query that references subform 5 35
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.
Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
This video teaches viewers about errors in exception handling.
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

708 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now