473,378 Members | 1,417 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

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 9485
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
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
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
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
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
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
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
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
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
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
by: =?Utf-8?B?QWxoYW1icmEgRWlkb3MgRGVzYXJyb2xsbw==?= | last post by:
Hi all mister, Which is THE BEST WAY IN THE WORLD AROUND for: 1. detect Network
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.