How to check internet Connectivity.
-
Hi, in my application i have a requirement to check the internet connection. The situation is my laptop is connected to LAN, and the outgoing internet trafiic is down(LAN is UP so i have the local IP). So i need to check this thru some c++ coding. I am basicaly using win32 . can you please help me out. I know the api InternetGetConnectedState(), but it always gives connected ,though i have connected to LAN. Do you have any idea how to detect that....
Birajendu SonicWALL Bangalore India
-
Hi, in my application i have a requirement to check the internet connection. The situation is my laptop is connected to LAN, and the outgoing internet trafiic is down(LAN is UP so i have the local IP). So i need to check this thru some c++ coding. I am basicaly using win32 . can you please help me out. I know the api InternetGetConnectedState(), but it always gives connected ,though i have connected to LAN. Do you have any idea how to detect that....
Birajendu SonicWALL Bangalore India
birajendu wrote:
I know the api InternetGetConnectedState(), but it always gives connected ,though i have connected to LAN.
It looks like you did not read the remarks section of the API in the doc? Take a look at InternetCheckConnection()[^]. With this function, you will be able to specify a URL that the API should check connectivity to.
It is a crappy thing, but it's life -^ Carlo Pallini
-
birajendu wrote:
I know the api InternetGetConnectedState(), but it always gives connected ,though i have connected to LAN.
It looks like you did not read the remarks section of the API in the doc? Take a look at InternetCheckConnection()[^]. With this function, you will be able to specify a URL that the API should check connectivity to.
It is a crappy thing, but it's life -^ Carlo Pallini
-
I tried the function you said. but its always giving not connected status only...
Birajendu SonicWALL Bangalore India
What URL did you try with this call? Are you able to reach that URL manually from that particular machine? Do you have a firewall? Is it configured to allow this application for outbound traffic? What does
GetLastError()
say?It is a crappy thing, but it's life -^ Carlo Pallini
-
What URL did you try with this call? Are you able to reach that URL manually from that particular machine? Do you have a firewall? Is it configured to allow this application for outbound traffic? What does
GetLastError()
say?It is a crappy thing, but it's life -^ Carlo Pallini
It is giving 12006 "The URL scheme could not be recognized, or is not supported." error.I tried with giving "google.com" in url field Incase of NULL in url field it is giving 12016 "The requested operation is invalid." error. Do you have any idea how to resolve thse errors. Obviously I am able to ping google.com from my machine.
Birajendu SonicWALL Bangalore India
-
It is giving 12006 "The URL scheme could not be recognized, or is not supported." error.I tried with giving "google.com" in url field Incase of NULL in url field it is giving 12016 "The requested operation is invalid." error. Do you have any idea how to resolve thse errors. Obviously I am able to ping google.com from my machine.
Birajendu SonicWALL Bangalore India
birajendu wrote:
It is giving 12006 "The URL scheme could not be recognized, or is not supported." error.I tried with giving "google.com" in url field
You tried passing "google.com" as the
lpszUrl
field value? The documentation has a description for this field, and that says: Pointer to a null-terminated string that specifies the URL[^] to use to check the connection. Notice that URL has a syntax. A valid URL that can be passed aslpszURL
would look like:_T("http://www.google.com")
Also, take a look at the example provided in MSDN for InternetGetConnectedState[^]It is a crappy thing, but it's life -^ Carlo Pallini
-
Hi, in my application i have a requirement to check the internet connection. The situation is my laptop is connected to LAN, and the outgoing internet trafiic is down(LAN is UP so i have the local IP). So i need to check this thru some c++ coding. I am basicaly using win32 . can you please help me out. I know the api InternetGetConnectedState(), but it always gives connected ,though i have connected to LAN. Do you have any idea how to detect that....
Birajendu SonicWALL Bangalore India
See here.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
-
What URL did you try with this call? Are you able to reach that URL manually from that particular machine? Do you have a firewall? Is it configured to allow this application for outbound traffic? What does
GetLastError()
say?It is a crappy thing, but it's life -^ Carlo Pallini
:laugh:
-
Hi, in my application i have a requirement to check the internet connection. The situation is my laptop is connected to LAN, and the outgoing internet trafiic is down(LAN is UP so i have the local IP). So i need to check this thru some c++ coding. I am basicaly using win32 . can you please help me out. I know the api InternetGetConnectedState(), but it always gives connected ,though i have connected to LAN. Do you have any idea how to detect that....
Birajendu SonicWALL Bangalore India
> I am basicaly using win32 Then you can see on Advanced Win32 ng news://nntp.aioe.org/comp.os.ms-windows.programmer.win32 or http://tinyurl.com/cmhb5g (official methods, used in Windows Shell...)