Solved

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

Posted on 1999-01-17
6
180 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
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 

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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
groupNoAdj 7 105
vb6 connector to mongodb 2 122
using web browser with BING 40 132
Export PDF Form fields to Access  or Excel  in Tab order 16 80
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
How to remove superseded packages in windows w60 or w61 installation media (.wim) or online system to prevent unnecessary space. w60 means Windows Vista or Windows Server 2008. w61 means Windows 7 or Windows Server 2008 R2. There are various …
This video teaches viewers about errors in exception handling.
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.

830 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