Jump to content

Internet connection without pinging


Recommended Posts

Three things:

1/ Is there a way to detect if you are behind a router to do a conditional search based on what the situation is?

2/ Not considering the first question, if the router is a problem, can you instead detect the connections speed from internal indicators to determine connection? Like if your connection is below 12mbps, most likely you are not connected, and even if you are, that speed is way too slow to do anything so exit the function.

3/ My particular situation, routers are not a concern, so it would still be helpfull if it is possible.

My interest in order with the three considerations would be 2, 3, 1.

I'm just trying to find someway of getting away from pinging or actually connecting for this particular purpose.

Edited by Champak
Link to comment
Share on other sites

If your don't have a network interface available the result of ipconfig should let you know.

Or this:

HI,

Func isOnline()
    If Ping("www.google.de") > 0 Then
        MsgBox(64, "Internet connection active!", "You internet connection is enabled...")
    Else
        MsgBox(16, "Internet connection failure!", "You internet connection is disabled...")
    EndIf
EndFunc   ;==>isOnline

Func _checkINet()
    $IsCon = DllCall("WinInet.dll", "int", "InternetGetConnectedState", "int_ptr", 0, "int", 0)
    If $IsCon[0] = 0 Then
        MsgBox(0, "NO CONNECTION", "Please Connect To The Internet Before Continuing")
    Else
        MsgBox(0, "CONNECTION", "Online")
    EndIf
EndFunc   ;==>_checkINet
EDIT: missing quote tag. Edited by Uten
Link to comment
Share on other sites

If ping is disabled for any reason (like my ISP has disabled ping to all sites), u can try this :-

$dataFound = _INetGetSource("www.google.com")
    If StringLen($dataFound) < 100 Then
;........."internet not working"..........
    Else
;..........."internet is working"..........
    EndIf

I'm not a programmer. Just a Power User.

Link to comment
Share on other sites

$INTERNET_CONNECTION_MODEM = 0x1
$INTERNET_CONNECTION_LAN = 0x2
$INTERNET_CONNECTION_PROXY = 0x4
$INTERNET_CONNECTION_MODEM_BUSY = 0x8
$INTERNET_RAS_INSTALLED = 0x10
$INTERNET_CONNECTION_OFFLINE = 0x20
$INTERNET_CONNECTION_CONFIGURED = 0x40

$ret = DllCall("WinInet.dll", "int", "InternetGetConnectedState", "int_ptr", 0, "int", 0)

If $ret[0] Then
   ;check type of connection
    $sX = "Connected !" & @LF & "------------------" & @LF
    If BitAND($ret[1], $INTERNET_CONNECTION_MODEM) Then $sX &= "MODEM" & @LF
    If BitAND($ret[1], $INTERNET_CONNECTION_LAN) Then $sX &= "LAN" & @LF
    If BitAND($ret[1], $INTERNET_CONNECTION_PROXY) Then $sX &= "PROXY" & @LF
    If BitAND($ret[1], $INTERNET_CONNECTION_MODEM_BUSY) Then $sX &= "MODEM_BUSY" & @LF
    If BitAND($ret[1], $INTERNET_RAS_INSTALLED) Then $sX &= "RAS_INSTALLED" & @LF
    If BitAND($ret[1], $INTERNET_CONNECTION_OFFLINE) Then $sX &= "OFFLINE" & @LF
    If BitAND($ret[1], $INTERNET_CONNECTION_CONFIGURED) Then $sX &= "CONFIGURED" & @LF
Else
    $sX = "Not Connected"
EndIf

MsgBox(4096, $ret[0] & ":" & $ret[1], $sX)

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...