Network Connection

  • Thread starter Thread starter Omar Abid
  • Start date Start date
O

Omar Abid

Hi,
I'm using my with a program to detect an internet connection.
It return true when I'm connected, but even when I 'm disconnected it
returns true
I don't know why ?
Thx
Omar Abid
 
Omar said:
Hi,
I'm using my with a program to detect an internet connection.
It return true when I'm connected, but even when I 'm disconnected it
returns true
I don't know why ?
Thx
Omar Abid
What command are you using?
 
Omar said:
my.network

My.Computer.Network.IsAvailable works fine for me, although I just have
a single connection to a LAN.

You could always ping a few popular addresses to see if you have an
Internet connection. E.G www.google.com, www.microsoft.com,
www.yahoo.com its unlikely that they will all be down at the same time.

You could send a webrequest in a try/catch statement, if it throws an
exception then there is a problem connecting to the internet and you are
not connected.

Also not having an active Internet connection doesn't mean that you are
not connected to a Network.

HTH,
Chris
 
my.network

I assuming you mean My.Computer.Network.IsAvailable()? If so I
wouldn't use it to determine and internet connection, but rather I
would use My.Computer.Network.Ping("www.google.com") - It will return
true only if the ping goes through - and not just if the computer is
talking to a network.

Thanks,

Seth Rowe
 
My.Computer.Network.IsAvailable works fine for me, although I just have
a single connection to a LAN.

You could always ping a few popular addresses to see if you have an
Internet connection. E.Gwww.google.com,www.microsoft.com,www.yahoo.comits unlikely that they will all be down at the same time.

You could send a webrequest in a try/catch statement, if it throws an
exception then there is a problem connecting to the internet and you are
not connected.

Also not having an active Internet connection doesn't mean that you are
not connected to a Network.

HTH,
Chris

You could always ping a few popular addresses to see if you have an
Internet connection. E.Gwww.google.com,www.microsoft.com,www.yahoo.comits unlikely that they will all be down at the same time.

Well, except for microsoft.com - I believe it's servers are configured
to refuse ping requests.

Thanks,

Seth Rowe
 
rowe_newsgroups said:
Well, except for microsoft.com - I believe it's servers are configured
to refuse ping requests.

Thanks,

Seth Rowe
Cool, didn't know that.
 
The problem isn' t solved.
Notice that i have several servers on my PC, does that change the
connection ?

You mean it's pinging fine? Even when not connected?

Thanks,

Seth Rowe
 
The problem isn' t solved.
Notice that i have several servers on my PC, does that change the
connection ?

I don't understand either?


Private Funtion IsConnectedToInternet() as Boolean
Try 'Not sure if this is necessary
If My.Computer.Network.Ping("www.google.com") = False Then
If My.Computer.Network.Ping("www.yahoo.com") = False Then
'NOT CONNECTED TO THE INTERNET
Return False
End If
End If
Catch Ex as Exception
'SOMETHING WRONG HAPPENED NOT CONNECTED
Return False
End Try
'YOU ARE CONNECTED TO THE INTERNET
Return True
End Function

Or

Private Function IsConnectedToInternet() As Boolean
Return My.Computer.Network.Ping("www.google.com")
End Function

Does that not solve your problem?
 
No it don't ping
but my.computer.network.isavailable = true even when I'm not connected

I don't think you understood me then - I said to not use
Network.IsAvailable but to use Network.Ping. Networks are different
than internet connections - so Network.IsAvailable will not always
work.

Thanks,

Seth Rowe
 
I don't understand either?

Private Funtion IsConnectedToInternet() as Boolean
Try 'Not sure if this is necessary
If My.Computer.Network.Ping("www.google.com") = False Then
If My.Computer.Network.Ping("www.yahoo.com") = False Then
'NOT CONNECTED TO THE INTERNET
Return False
End If
End If
Catch Ex as Exception
'SOMETHING WRONG HAPPENED NOT CONNECTED
Return False
End Try
'YOU ARE CONNECTED TO THE INTERNET
Return True
End Function

Or

Private Function IsConnectedToInternet() As Boolean
Return My.Computer.Network.Ping("www.google.com")
End Function

Does that not solve your problem?

That's work fine with me Thx
 
I don't think you understood me then - I said to not use
Network.IsAvailable but to use Network.Ping. Networks are different
than internet connections - so Network.IsAvailable will not always
work.

Thanks,

Seth Rowe- Masquer le texte des messages précédents -

- Afficher le texte des messages précédents -

I think because i have front page and asp server running
By the way i used the code in up and that run correctly
Thx to you all
Omar Abid
 
Back
Top