dbTalk Databases Forums  

Detecting network media connect / link state

comp.databases.ms-access comp.databases.ms-access


Discuss Detecting network media connect / link state in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
The Frog
 
Posts: n/a

Default Detecting network media connect / link state - 01-10-2011 , 09:25 AM






Hi Everyone,

First, happy new year to you all. I hope you have had a great
Christmas and holiday period. I am just this very day back at work,
and already straight back to it. I am working on an application for my
colleagues that pulls data from a central server (this may end up
being MySQL, MSSQL, SharePoint, Oracle, SAP....... I just dont know
yet!). The users will all have laptops and during the course of their
day they will have mixed connectivity situations - from none to WAN to
LAN, and sometimes VPN.

In order to make this application work properly I need to localise a
copy of the 'master data' that they will be processing. To do this I
need to pull down a resultset or two and store them locally. No probs
so far. My issue is in being able to determine the connected state of
the laptops throughout the course of their working day. I can PING to
determine the presence or absence of an IP or HOSTNAME. So far so
good. Where I am stuck is in determining the media connection LINK
STATE for each of the available adapters.

What I would like to do is to be able to determine if there is
actually a network connection at all before trying to do anything else
with the app (as far as pulling updated data is concerned). If I can
detect an 'UP' LINK STATE for any adapter then I can try and ping the
required resource. Or maybe I am just making this too complicated? If
there is a way to read this LINK STATE from the registry or some other
means that would be great. I am hoping to build this into a class
module that handles all the networking functionality required for the
application.

Cheers

The Frog

Reply With Quote
  #2  
Old   
Stuart McCall
 
Posts: n/a

Default Re: Detecting network media connect / link state - 01-10-2011 , 06:16 PM






"The Frog" <mr.frog.to.you (AT) googlemail (DOT) com> wrote

Quote:
Hi Everyone,

First, happy new year to you all. I hope you have had a great
Christmas and holiday period. I am just this very day back at work,
and already straight back to it. I am working on an application for my
colleagues that pulls data from a central server (this may end up
being MySQL, MSSQL, SharePoint, Oracle, SAP....... I just dont know
yet!). The users will all have laptops and during the course of their
day they will have mixed connectivity situations - from none to WAN to
LAN, and sometimes VPN.

In order to make this application work properly I need to localise a
copy of the 'master data' that they will be processing. To do this I
need to pull down a resultset or two and store them locally. No probs
so far. My issue is in being able to determine the connected state of
the laptops throughout the course of their working day. I can PING to
determine the presence or absence of an IP or HOSTNAME. So far so
good. Where I am stuck is in determining the media connection LINK
STATE for each of the available adapters.

What I would like to do is to be able to determine if there is
actually a network connection at all before trying to do anything else
with the app (as far as pulling updated data is concerned). If I can
detect an 'UP' LINK STATE for any adapter then I can try and ping the
required resource. Or maybe I am just making this too complicated? If
there is a way to read this LINK STATE from the registry or some other
means that would be great. I am hoping to build this into a class
module that handles all the networking functionality required for the
application.

Cheers

The Frog

Happy new year to you, too. You could use the Dir function to check for the
presence of a known file, eg

GotConnection = Len(Dir("\\ServerName\DirName\FileName") > 0)

Reply With Quote
  #3  
Old   
The Frog
 
Posts: n/a

Default Re: Detecting network media connect / link state - 01-11-2011 , 02:30 AM



Hi Stuart,

Thanks for the response. I thought about this but the problem is
actually a little more subtle. What I want to ensure is that no data
is fed back to the 'master' database unless the user is connected by
LAN - so no VPN's, no Wireless LAN, etc... I can control for the
errors that the users will introduce by doing careless things like
switching the laptop off halfway through an update (inserting to the
master), but it will result in loads of complaints from the users of
the nature "It takes too long to do X, whinge whinge whinge.......".
To avoid setting their expectations too high I need to limit it to a
LAN connection only.

I was doing a little research on this yesterday and came across a
VBScript example that uses WMI to retrieve this information. Here is
an example: http://www.eggheadcafe.com/software/...-registry.aspx You need to look
about half way down the page to see the example. It seems to be able
to provide a great deal of information, similar to the IPCONFIG
command from a DOS prompt. I have no experience in using WMI and so I
am struggling to understand the script completely. From what I do
understand you need to fire a question at a WMI object similar to how
you can use SQL with DAO / ADO, and then loop through the results to
find what you want.

Sounds like a fairly clean and standardised way to go. I am wondering
if anyone has a way of interpreting that script into the SQL like
query that need to be asked to WMI? The example above might work well
for scripting but I need to handle the results a little differently to
example.

Any help would be greatly appreciated.

Cheers

The Frog

Reply With Quote
  #4  
Old   
Bob Barrows
 
Posts: n/a

Default Re: Detecting network media connect / link state - 01-11-2011 , 04:34 AM



The Frog wrote:
Quote:
Hi Stuart,

Thanks for the response. I thought about this but the problem is
actually a little more subtle. What I want to ensure is that no data
is fed back to the 'master' database unless the user is connected by
LAN - so no VPN's, no Wireless LAN, etc... I can control for the
errors that the users will introduce by doing careless things like
switching the laptop off halfway through an update (inserting to the
master), but it will result in loads of complaints from the users of
the nature "It takes too long to do X, whinge whinge whinge.......".
To avoid setting their expectations too high I need to limit it to a
LAN connection only.

I was doing a little research on this yesterday and came across a
VBScript example that uses WMI to retrieve this information. Here is
an example: http://www.eggheadcafe.com/software/...-registry.aspx You need to look
about half way down the page to see the example. It seems to be able
to provide a great deal of information, similar to the IPCONFIG
command from a DOS prompt. I have no experience in using WMI and so I
am struggling to understand the script completely. From what I do
understand you need to fire a question at a WMI object similar to how
you can use SQL with DAO / ADO, and then loop through the results to
find what you want.

Sounds like a fairly clean and standardised way to go. I am wondering
if anyone has a way of interpreting that script into the SQL like
query that need to be asked to WMI? The example above might work well
for scripting but I need to handle the results a little differently to
example.

What a coincidence! Database Weekly just posted a link to a WMI Code
Generator that _might_ be what you are looking for, let's see ... here it
is:
https://www.microsoft.com/downloads/...displaylang=en

It will require using VBA to shell out to the OS to execute the generated
code of course.

Reply With Quote
  #5  
Old   
David-W-Fenton
 
Posts: n/a

Default Re: Detecting network media connect / link state - 01-11-2011 , 03:47 PM



The Frog <mr.frog.to.you (AT) googlemail (DOT) com> wrote in
news:0eedbcce-4614-4898-a114-227878418f33 (AT) p1g2000yqm (DOT) googlegroups.com
:

Quote:
I am working on an application for my
colleagues that pulls data from a central server (this may end up
being MySQL, MSSQL, SharePoint, Oracle, SAP....... I just dont
know yet!). The users will all have laptops and during the course
of their day they will have mixed connectivity situations - from
none to WAN to LAN, and sometimes VPN.
If you need local data that synchs with the central data store,
wouldn't that be a good argument for using Sharepoint to manage your
data? I'm not sure of the details of how this is implemented, but it
is apparently quite reliable.

It would mean you'd be committed to one platform, but it also means
you'd be able to skip a whole boatload of complicated
programming/data problems.

--
David W. Fenton http://www.dfenton.com/
contact via website only http://www.dfenton.com/DFA/

Reply With Quote
  #6  
Old   
David-W-Fenton
 
Posts: n/a

Default Re: Detecting network media connect / link state - 01-11-2011 , 03:49 PM



"Stuart McCall" <smccall (AT) myunrealbox (DOT) com> wrote in
news:KjNWo.92093$SY.88759 (AT) newsfe06 (DOT) ams2:

Quote:
You could use the Dir function to check for the
presence of a known file, eg

GotConnection = Len(Dir("\\ServerName\DirName\FileName") > 0)
I find that using the File System Object is more reliable than
Dir(), which can error out in ways that are not helpful. It is also
slow to give up, whereas the FSO method knows there's no network and
returns more quickly.

--
David W. Fenton http://www.dfenton.com/
contact via website only http://www.dfenton.com/DFA/

Reply With Quote
  #7  
Old   
David-W-Fenton
 
Posts: n/a

Default Re: Detecting network media connect / link state - 01-11-2011 , 03:51 PM



The Frog <mr.frog.to.you (AT) googlemail (DOT) com> wrote in
news:c19ac5f4-fb76-4934-9869-5375fb4bab96 (AT) l17g2000yqe (DOT) googlegroups.co
m:

Quote:
What I want to ensure is that no data
is fed back to the 'master' database unless the user is connected
by LAN - so no VPN's, no Wireless LAN, etc.
If the different connection methods use different IP ranges, you
might be able to use the IP address to figure out which is being
used.

However, I have clients with both wired and WiFi on laptops, and
both can be active simultaneously. I have no idea how Windows
decides which to use, except in the cases where the sought-after
resource is clearly only available through the one connection.

--
David W. Fenton http://www.dfenton.com/
contact via website only http://www.dfenton.com/DFA/

Reply With Quote
  #8  
Old   
Stuart McCall
 
Posts: n/a

Default Re: Detecting network media connect / link state - 01-11-2011 , 06:41 PM



"David-W-Fenton" <dfassoc (AT) dfenton (DOT) com> wrote

Quote:
"Stuart McCall" <smccall (AT) myunrealbox (DOT) com> wrote in
news:KjNWo.92093$SY.88759 (AT) newsfe06 (DOT) ams2:

You could use the Dir function to check for the
presence of a known file, eg

GotConnection = Len(Dir("\\ServerName\DirName\FileName") > 0)

I find that using the File System Object is more reliable than
Dir(), which can error out in ways that are not helpful. It is also
slow to give up, whereas the FSO method knows there's no network and
returns more quickly.
I must admit I didn't know that fso was quicker in this regard, and I have
no way to test it these days, but I wonder if you could expound on your
unreliability claim, which I've never encountered.

Quote:
--
David W. Fenton http://www.dfenton.com/
contact via website only http://www.dfenton.com/DFA/

Reply With Quote
  #9  
Old   
Tony Toews
 
Posts: n/a

Default Re: Detecting network media connect / link state - 01-12-2011 , 01:06 AM



On Tue, 11 Jan 2011 00:30:34 -0800 (PST), The Frog
<mr.frog.to.you (AT) googlemail (DOT) com> wrote:

Quote:
Thanks for the response. I thought about this but the problem is
actually a little more subtle. What I want to ensure is that no data
is fed back to the 'master' database unless the user is connected by
LAN - so no VPN's, no Wireless LAN, etc...
One possible means of differentiating between wired connection, WiFi
and cell phone is to look at the connect speed of the device. If 10
(unlikely), 100 or 1000 mbps then it's wired. If not then it's not.
However as David points out folks can have multiple devices and how do
you know which Access is using? Maybe force them to turn off all
other connections.

But then what if it a legitimate VPN is present? Ah well.

Tony
--
Tony Toews, Microsoft Access MVP
Tony's Main MS Access pages - http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
For a convenient utility to keep your users FEs and other files
updated see http://www.autofeupdater.com/

Reply With Quote
  #10  
Old   
The Frog
 
Posts: n/a

Default Re: Detecting network media connect / link state - 01-12-2011 , 02:33 AM



Hi Guys,

Firstly to David: Sharepoint would be perfect in this scenario, but
alas the IT dept of this company doesnt provide this as a 'service'
and as a department we are not allowed to implement our own (I tried
to approach this topic for many technical resources that we are
missing that are relatively commonplace in most firms and was
threatened with instant dismissal if I ever attempted to broach the
topic again or tried to implement anything on my own. This IT group is
paranoid about control and suffers from the unfortunate delusion that
they are up-to-date and 'world class' simply because they migrated us
from Office 97 last year to Office 2000. Dont get me wrong, there are
some really good people in this companies IT group, they just cant
perform due to the draconian policies of their 'master' - the same
dude who threatened me with dismissal. He reminds me a bit of
MasterControl in Tron actually.....)

Anyway, my hope is to at least reduce the risk of problems by trying
to detect several factors at the same time and making a go / no go
decision based on that.
a) Is there a connection on the wired LAN
b) What is the path (tracert) from the machine to the target location
c) Does the media link status change during the connection.....

May largest concern is users pushing data back to the BE and not
bothering to wait till its done (Close the lid on the laptops, pull
the cable and walk to a meeting somewhere in the building for
example). The data sets are sometimes quite large (several hundred
thousand records) and the network is slooooooooooow. Now I can do some
things to minimise risk here, but I would like to try and limit the
opportunity in the 'upload' parts of the application to when a wired
connection at least is present and to the companies local LAN (the IP
ranges are constantly changing as the IT group plays with the DNS and
DHCP set-up on an almost weekly basis). Suffice to say, its a pain in
the butt of an environment to work in. Did I mention that they (IT)
routinely and without explanation or warning remove .dll's from every
machine in the office? When asked about this the response is usually
either 'Justify why that dll is needed (eg/ ones installed by default
with office)' or 'Oh yeah, sorry, we'll try and get it back to you
later'. Really wonderful place (sorry, I whinging now.........)

Anyway, I will have a dig through the article Bob listed above and see
what I can come up with. I may be asking too much from too little in
being able to solve this problem. I do have to try though........

The Frog

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.