473,804 Members | 3,138 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 9532
http://www.vbip.com/wininet/wininet_connection_01.asp

OR

Imports System.Manageme nt

Public Function GetSignalStreng th() As String
On Error Resume Next
Dim query As ManagementObjec tSearcher
Dim Qc As ManagementObjec tCollection
Dim Oq As ObjectQuery
Dim Ms As ManagementScope
Dim Co As ConnectionOptio ns
Dim Mo As ManagementObjec t
Dim outp As String
Co = New ConnectionOptio ns
Ms = New ManagementScope ("root\wmi")
Oq = New ObjectQuery("SE LECT * FROM MSNdis_80211_Re ceivedSignalStr ength
Where active=true")
query = New ManagementObjec tSearcher(Ms, Oq)
Qc = query.Get
For Each Mo In query.Get
outp = outp & Mo("Ndis80211Re ceivedSignalStr ength") & " "
ISIPActive = Mo("Active")
Next
Return outp.Trim()
End Function

OR

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

Private Sub GetNetworkStatu s()
Dim moReturn As Management.Mana gementObjectCol lection
Dim moSearch As Management.Mana gementObjectSea rcher
Dim mo As Management.Mana gementObject

moSearch = New Management.Mana gementObjectSea rcher("Select * from
Win32_NetworkCo nnection")

moReturn = moSearch.Get
For Each mo In moReturn
Dim strOut As String
strOut = String.Format(" {0} - Status {1}", mo("Name").ToSt ring,
mo("Status").To String)
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******** *************** ***********@mic rosoft.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

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

OR

Imports System.Manageme nt

Public Function GetSignalStreng th() As String
On Error Resume Next
Dim query As ManagementObjec tSearcher
Dim Qc As ManagementObjec tCollection
Dim Oq As ObjectQuery
Dim Ms As ManagementScope
Dim Co As ConnectionOptio ns
Dim Mo As ManagementObjec t
Dim outp As String
Co = New ConnectionOptio ns
Ms = New ManagementScope ("root\wmi")
Oq = New ObjectQuery("SE LECT * FROM MSNdis_80211_Re ceivedSignalStr ength
Where active=true")
query = New ManagementObjec tSearcher(Ms, Oq)
Qc = query.Get
For Each Mo In query.Get
outp = outp & Mo("Ndis80211Re ceivedSignalStr ength") & " "
ISIPActive = Mo("Active")
Next
Return outp.Trim()
End Function

OR

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

Private Sub GetNetworkStatu s()
Dim moReturn As Management.Mana gementObjectCol lection
Dim moSearch As Management.Mana gementObjectSea rcher
Dim mo As Management.Mana gementObject

moSearch = New Management.Mana gementObjectSea rcher("Select * from
Win32_NetworkCo nnection")

moReturn = moSearch.Get
For Each mo In moReturn
Dim strOut As String
strOut = String.Format(" {0} - Status {1}", mo("Name").ToSt ring,
mo("Status").To String)
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******** *************** ***********@mic rosoft.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

"scorpion53 061" <ad***@nospamhe rekjmsolutions. com> wrote in message
news:eO******** ******@TK2MSFTN GP12.phx.gbl...
http://www.vbip.com/wininet/wininet_connection_01.asp

OR

Imports System.Manageme nt

Public Function GetSignalStreng th() As String
On Error Resume Next
Dim query As ManagementObjec tSearcher
Dim Qc As ManagementObjec tCollection
Dim Oq As ObjectQuery
Dim Ms As ManagementScope
Dim Co As ConnectionOptio ns
Dim Mo As ManagementObjec t
Dim outp As String
Co = New ConnectionOptio ns
Ms = New ManagementScope ("root\wmi")
Oq = New ObjectQuery("SE LECT * FROM MSNdis_80211_Re ceivedSignalStr ength
Where active=true")
query = New ManagementObjec tSearcher(Ms, Oq)
Qc = query.Get
For Each Mo In query.Get
outp = outp & Mo("Ndis80211Re ceivedSignalStr ength") & " "
ISIPActive = Mo("Active")
Next
Return outp.Trim()
End Function

OR

http://msdn.microsoft.com/library/de...connection.asp
Private Sub GetNetworkStatu s()
Dim moReturn As Management.Mana gementObjectCol lection
Dim moSearch As Management.Mana gementObjectSea rcher
Dim mo As Management.Mana gementObject

moSearch = New Management.Mana gementObjectSea rcher("Select * from
Win32_NetworkCo nnection")

moReturn = moSearch.Get
For Each mo In moReturn
Dim strOut As String
strOut = String.Format(" {0} - Status {1}", mo("Name").ToSt ring,
mo("Status").To String)
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******** *************** ***********@mic rosoft.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**********@N oSpam.com> wrote in message
news:#B******** ******@TK2MSFTN GP15.phx.gbl:
You might want to strip out that:
On Error Resume Next statement though. Ouch.

Steve

"scorpion53 061" <ad***@nospamhe rekjmsolutions. com> wrote in message
news:eO******** ******@TK2MSFTN GP12.phx.gbl...
http://www.vbip.com/wininet/wininet_connection_01.asp

OR

Imports System.Manageme nt

Public Function GetSignalStreng th() As String
On Error Resume Next
Dim query As ManagementObjec tSearcher
Dim Qc As ManagementObjec tCollection
Dim Oq As ObjectQuery
Dim Ms As ManagementScope
Dim Co As ConnectionOptio ns
Dim Mo As ManagementObjec t
Dim outp As String
Co = New ConnectionOptio ns
Ms = New ManagementScope ("root\wmi")
Oq = New ObjectQuery("SE LECT * FROM
MSNdis_80211_Re ceivedSignalStr ength
Where active=true")
query = New ManagementObjec tSearcher(Ms, Oq)
Qc = query.Get
For Each Mo In query.Get
outp = outp & Mo("Ndis80211Re ceivedSignalStr ength") & " "
ISIPActive = Mo("Active")
Next
Return outp.Trim()
End Function

OR


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

Private Sub GetNetworkStatu s()
Dim moReturn As Management.Mana gementObjectCol lection
Dim moSearch As Management.Mana gementObjectSea rcher
Dim mo As Management.Mana gementObject

moSearch = New Management.Mana gementObjectSea rcher("Select * from
Win32_NetworkCo nnection")

moReturn = moSearch.Get
For Each mo In moReturn
Dim strOut As String
strOut = String.Format(" {0} - Status {1}", mo("Name").ToSt ring,
mo("Status").To String)
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/northwindunplug ged.asp

"Al" <Al@discussions .microsoft.com> wrote in message
news:28******** *************** ***********@mic rosoft.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
2629
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 cases, I believe I receive an OperationalError (or is it an InterfaceError?). Is it possible (and if so - how?) to verify that the exception occured because of row locking, so that I can wait and try again?
1
3359
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 signal is weak, the status may have one squares or zero on the phone. How could I do if I want to detect the status of the network? Thx and Best Regards.
6
4020
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
1532
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 above method above detect network connectivity of some other type? There seems to be a delay capturing the disconnect-connect events when I do use it, is there a way to shorten this delay? In essence, what does this method wrap? Regards,
5
45071
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; while(tcpSocket.Connected)
4
3856
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). I had some troubles when I started 6 threads (each thread made a separate connection) and sent messages to same server simultaneously. Sometimes, not always, the socket looks like ok, but really it is dead. I don't why it happens.
8
3033
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 the plant with a wireless connection. There are some pockets of non-connectivity. I've been tasked with disabling the submit button on the form if the network is unavailable. Possible solution: I can instantiate a timed process (VB.NET 2.0
5
2708
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 may block ping requesting. Best Regards, Ke Tao
1
6691
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
3597
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
9706
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10575
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10330
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10076
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9144
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7616
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5520
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4297
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 we have to send another system
2
3816
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.