473,511 Members | 10,195 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to Detect Network Connection

Al
Hi,
Is there any way to detected if a device is connected? How would I query to
see the device is connected to network. My application is mobile and mostly
on wireless connection but it could be wired as well. Any Help would be
appreciated.
Regards
Al

Nov 21 '05 #1
5 9508
http://www.vbip.com/wininet/wininet_connection_01.asp

OR

Imports System.Management

Public Function GetSignalStrength() As String
On Error Resume Next
Dim query As ManagementObjectSearcher
Dim Qc As ManagementObjectCollection
Dim Oq As ObjectQuery
Dim Ms As ManagementScope
Dim Co As ConnectionOptions
Dim Mo As ManagementObject
Dim outp As String
Co = New ConnectionOptions
Ms = New ManagementScope("root\wmi")
Oq = New ObjectQuery("SELECT * FROM MSNdis_80211_ReceivedSignalStrength
Where active=true")
query = New ManagementObjectSearcher(Ms, Oq)
Qc = query.Get
For Each Mo In query.Get
outp = outp & Mo("Ndis80211ReceivedSignalStrength") & " "
ISIPActive = Mo("Active")
Next
Return outp.Trim()
End Function

OR

http://msdn.microsoft.com/library/de...connection.asp

Private Sub GetNetworkStatus()
Dim moReturn As Management.ManagementObjectCollection
Dim moSearch As Management.ManagementObjectSearcher
Dim mo As Management.ManagementObject

moSearch = New Management.ManagementObjectSearcher("Select * from
Win32_NetworkConnection")

moReturn = moSearch.Get
For Each mo In moReturn
Dim strOut As String
strOut = String.Format("{0} - Status {1}", mo("Name").ToString,
mo("Status").ToString)
Trace.WriteLine(strOut)
Next
End Sub

Here is a link to see if you are connected to a network that uses a
ping

http://msdn.microsoft.com/library/de...dunplugged.asp

"Al" <Al@discussions.microsoft.com> wrote in message
news:28**********************************@microsof t.com:
Hi,
Is there any way to detected if a device is connected? How would I query
to
see the device is connected to network. My application is mobile and
mostly
on wireless connection but it could be wired as well. Any Help would be
appreciated.
Regards
Al


Nov 21 '05 #2
Al
Thank you so much

"scorpion53061" wrote:
http://www.vbip.com/wininet/wininet_connection_01.asp

OR

Imports System.Management

Public Function GetSignalStrength() As String
On Error Resume Next
Dim query As ManagementObjectSearcher
Dim Qc As ManagementObjectCollection
Dim Oq As ObjectQuery
Dim Ms As ManagementScope
Dim Co As ConnectionOptions
Dim Mo As ManagementObject
Dim outp As String
Co = New ConnectionOptions
Ms = New ManagementScope("root\wmi")
Oq = New ObjectQuery("SELECT * FROM MSNdis_80211_ReceivedSignalStrength
Where active=true")
query = New ManagementObjectSearcher(Ms, Oq)
Qc = query.Get
For Each Mo In query.Get
outp = outp & Mo("Ndis80211ReceivedSignalStrength") & " "
ISIPActive = Mo("Active")
Next
Return outp.Trim()
End Function

OR

http://msdn.microsoft.com/library/de...connection.asp

Private Sub GetNetworkStatus()
Dim moReturn As Management.ManagementObjectCollection
Dim moSearch As Management.ManagementObjectSearcher
Dim mo As Management.ManagementObject

moSearch = New Management.ManagementObjectSearcher("Select * from
Win32_NetworkConnection")

moReturn = moSearch.Get
For Each mo In moReturn
Dim strOut As String
strOut = String.Format("{0} - Status {1}", mo("Name").ToString,
mo("Status").ToString)
Trace.WriteLine(strOut)
Next
End Sub

Here is a link to see if you are connected to a network that uses a
ping

http://msdn.microsoft.com/library/de...dunplugged.asp

"Al" <Al@discussions.microsoft.com> wrote in message
news:28**********************************@microsof t.com:
Hi,
Is there any way to detected if a device is connected? How would I query
to
see the device is connected to network. My application is mobile and
mostly
on wireless connection but it could be wired as well. Any Help would be
appreciated.
Regards
Al


Nov 21 '05 #3
You might want to strip out that:
On Error Resume Next statement though. Ouch.

Steve

"scorpion53061" <ad***@nospamherekjmsolutions.com> wrote in message
news:eO**************@TK2MSFTNGP12.phx.gbl...
http://www.vbip.com/wininet/wininet_connection_01.asp

OR

Imports System.Management

Public Function GetSignalStrength() As String
On Error Resume Next
Dim query As ManagementObjectSearcher
Dim Qc As ManagementObjectCollection
Dim Oq As ObjectQuery
Dim Ms As ManagementScope
Dim Co As ConnectionOptions
Dim Mo As ManagementObject
Dim outp As String
Co = New ConnectionOptions
Ms = New ManagementScope("root\wmi")
Oq = New ObjectQuery("SELECT * FROM MSNdis_80211_ReceivedSignalStrength
Where active=true")
query = New ManagementObjectSearcher(Ms, Oq)
Qc = query.Get
For Each Mo In query.Get
outp = outp & Mo("Ndis80211ReceivedSignalStrength") & " "
ISIPActive = Mo("Active")
Next
Return outp.Trim()
End Function

OR

http://msdn.microsoft.com/library/de...connection.asp
Private Sub GetNetworkStatus()
Dim moReturn As Management.ManagementObjectCollection
Dim moSearch As Management.ManagementObjectSearcher
Dim mo As Management.ManagementObject

moSearch = New Management.ManagementObjectSearcher("Select * from
Win32_NetworkConnection")

moReturn = moSearch.Get
For Each mo In moReturn
Dim strOut As String
strOut = String.Format("{0} - Status {1}", mo("Name").ToString,
mo("Status").ToString)
Trace.WriteLine(strOut)
Next
End Sub

Here is a link to see if you are connected to a network that uses a
ping

http://msdn.microsoft.com/library/de...dunplugged.asp
"Al" <Al@discussions.microsoft.com> wrote in message
news:28**********************************@microsof t.com:
Hi,
Is there any way to detected if a device is connected? How would I query
to
see the device is connected to network. My application is mobile and
mostly
on wireless connection but it could be wired as well. Any Help would be
appreciated.
Regards
Al

Nov 21 '05 #4
Kelly,

Thanks,

Cor
Nov 21 '05 #5
LOL

I forgot my perfection pills today.

"Steve Long" <St**********@NoSpam.com> wrote in message
news:#B**************@TK2MSFTNGP15.phx.gbl:
You might want to strip out that:
On Error Resume Next statement though. Ouch.

Steve

"scorpion53061" <ad***@nospamherekjmsolutions.com> wrote in message
news:eO**************@TK2MSFTNGP12.phx.gbl...
http://www.vbip.com/wininet/wininet_connection_01.asp

OR

Imports System.Management

Public Function GetSignalStrength() As String
On Error Resume Next
Dim query As ManagementObjectSearcher
Dim Qc As ManagementObjectCollection
Dim Oq As ObjectQuery
Dim Ms As ManagementScope
Dim Co As ConnectionOptions
Dim Mo As ManagementObject
Dim outp As String
Co = New ConnectionOptions
Ms = New ManagementScope("root\wmi")
Oq = New ObjectQuery("SELECT * FROM
MSNdis_80211_ReceivedSignalStrength
Where active=true")
query = New ManagementObjectSearcher(Ms, Oq)
Qc = query.Get
For Each Mo In query.Get
outp = outp & Mo("Ndis80211ReceivedSignalStrength") & " "
ISIPActive = Mo("Active")
Next
Return outp.Trim()
End Function

OR


http://msdn.microsoft.com/library/de...us/wmisdk/wmi/
win32_networkconnection.asp

Private Sub GetNetworkStatus()
Dim moReturn As Management.ManagementObjectCollection
Dim moSearch As Management.ManagementObjectSearcher
Dim mo As Management.ManagementObject

moSearch = New Management.ManagementObjectSearcher("Select * from
Win32_NetworkConnection")

moReturn = moSearch.Get
For Each mo In moReturn
Dim strOut As String
strOut = String.Format("{0} - Status {1}", mo("Name").ToString,
mo("Status").ToString)
Trace.WriteLine(strOut)
Next
End Sub

Here is a link to see if you are connected to a network that uses a
ping


http://msdn.microsoft.com/library/de...us/dndotnet/ht
ml/northwindunplugged.asp

"Al" <Al@discussions.microsoft.com> wrote in message
news:28**********************************@microsof t.com:
Hi,
Is there any way to detected if a device is connected? How would I
query
to
see the device is connected to network. My application is mobile and
mostly
on wireless connection but it could be wired as well. Any Help would
be
appreciated.
Regards
Al


Nov 21 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
2573
by: Alban Hertroys | last post by:
Good day, I have a number of threads doing inserts in a table, after which I want to do a select. This means that it will occur that the row that I want to select is locked (by the DB). In these...
1
3326
by: ripken95 | last post by:
I connect to the internet through ADSL. I want to write the web page which can detect the connection status with javascript. This detection is like the signal detection in the mobile phone. If the...
6
3975
by: Stephane Belzile | last post by:
Is there a way I can detect in vb.Net the power has switched to a UPS unit in case of power failure? Thanks
0
1508
by: Giovanni | last post by:
Hi, I am using VS 2005 - BETA 2. I'd like to use My.Computer.Network.IsAvailable to detect whether an internet connection is available. Is this the best "new" way of doing things or does the...
5
44945
by: Morten | last post by:
How do I detect if a client socket is no longer connected to the listen tcp socket ? I have tried with (just an example): --------------------- Socket tcpSocket; ...
4
3828
by: Frank Meng | last post by:
Hi. I am trying a csharp sample from http://www.codeproject.com/csharp/socketsincs.asp . (Sorry I didn't post all the source codes here, please get the codes from above link if you want to try)....
8
3006
by: BJ | last post by:
Problem: How can I code up a client side process to detect if the network is available? Synopsis: I am writing ASP.NET input forms for a Panasonic Tuff book. The users will be walking around...
5
2692
by: Ke Tao | last post by:
HI All, Is there anybody have an idea of how to detect internet is reachable ? At present , I'm using ping to detect internet is reachable , but it's maybe a bad idea , some firewall of router...
1
6664
by: =?Utf-8?B?QWxoYW1icmEgRWlkb3MgRGVzYXJyb2xsbw==?= | last post by:
Hi all mister, Which is THE BEST WAY IN THE WORLD AROUND for: 1. detect Network
3
3579
by: =?Utf-8?B?QWxoYW1icmEgRWlkb3MgRGVzYXJyb2xsbw==?= | last post by:
Hi all mister, Which is THE BEST WAY IN THE WORLD AROUND for: 1. detect Network
0
7251
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7517
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5072
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4743
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3230
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3217
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1581
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
790
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
451
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.