[AccessD] detect network

Jim DeMarco Jdemarco at hshhp.org
Fri Jun 20 09:04:53 CDT 2003


Good points.

Thanks,

Jim DeMarco


-----Original Message-----
From: Jim Dettman [mailto:jimdettman at earthlink.net]
Sent: Friday, June 20, 2003 8:54 AM
To: accessd at databaseadvisors.com
Subject: RE: [AccessD] detect network


Jim,

  <<Thanks.  The app is being distributed to a number of companies so I've
been looking for something generic that won't need any direction as to where
to look.  I found a simple API this AM that I think does the trick:>>

  That being the case, then I'd go for something as simple as possible, like
trying the operation and trapping the error.  When you start talking API,
then you need to worry about the OS, what is or is not installed, etc. Just
look at the comments on what you posted.  Will it work with XP?

Jim Dettman
President,
Online Computer Services of WNY, Inc.
(315) 699-3443
jimdettman at earthlink.net

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com]On Behalf Of Jim DeMarco
Sent: Friday, June 20, 2003 8:42 AM
To: accessd at databaseadvisors.com
Subject: RE: [AccessD] detect network


Thanks.  The app is being distributed to a number of companies so I've been
looking for something generic that won't need any direction as to where to
look.  I found a simple API this AM that I think does the trick:

'Requires Windows 2000
'(or Windows NT 4.0 with Internet Explorer 5 or later);
'Requires Windows 95 or later (with Internet Explorer 5 or later)

'Parameter info
'· lpdwFlags
'Provides information on the type of network connection available when the
return value is TRUE. The flags can be:
'NETWORK_ALIVE_LAN
'The computer has one or more LAN cards that are active.
'NETWORK_ALIVE_WAN
'The computer has one or more active RAS connections.
'NETWORK_ALIVE_AOL
'This flag is only valid in Windows 95 and Windows 98. Indicates the
computer is connected to the America Online network.

'Return Values
'
'TRUE
'The local system is connected to a network.
'FALSE
'Call GetLastError to determine the reason for no connectivity.

Const NETWORK_ALIVE_AOL = &H4
Const NETWORK_ALIVE_LAN = &H1
Const NETWORK_ALIVE_WAN = &H2

Declare Function IsNetworkAlive Lib "SENSAPI.DLL" (ByRef lpdwFlags As Long)
As Long

Public Function AmIConnected() As Boolean
    'KPD-Team 2001
    'URL: http://www.allapi.net/
    'E-Mail: KPDTeam at Allapi.net
    Dim Ret As Long
    Dim blnReturn As Boolean
    blnReturn = IsNetworkAlive(Ret) <> 0 And Ret <> NETWORK_ALIVE_AOL 'we're
just interested in lan/wan
    AmIConnected = blnReturn
End Function

Thanks,

Jim DeMarco
Director of Product Development
HealthSource/Hudson Health Plan


-----Original Message-----
From: Jim Dettman [mailto:jimdettman at earthlink.net]
Sent: Friday, June 20, 2003 8:13 AM
To: accessd at databaseadvisors.com
Subject: RE: [AccessD] detect network


Jim,

  Not sure if this will fit your needs or not, but how about issuing a shell
command with:

  Ping <address of server>  >netchk.txt

  Then open and parse netchk.txt.  You just need to look for the word
"reply".   If found, you have a physical connection at least to the server.

<<Or should we just try to hit the central DB at app start and trap the
error?  I don't want to generate an error if I don't have to.>>

  That's what I would do.  To many things can foul things up (ie. security)
beyond simply checking for a connection.  Of course, I suppose it depends on
what you meant by "a connection".

   But in the end result, it's your app that needs to carry out whatever
operation.  By the time you've done enough checking to verify that the app
will be able to perform whatever, you might as well have just tried it.

Jim Dettman
President,
Online Computer Services of WNY, Inc.
(315) 699-3443
jimdettman at earthlink.net

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com]On Behalf Of Jim DeMarco
Sent: Thursday, June 19, 2003 8:33 AM
To: AccessD (E-mail)
Subject: [AccessD] detect network


We've got a data collection application that will be run on disconnected
laptops.  At least once a week the laptop users will come in to the home
office to dump the data they've collected into our central SQL database.
Does anyone have any code that will detect that the laptop is connected to
our network so we can point their connection to the central DB (as opposed
to their local DB)?  Or should we just try to hit the central DB at app
start and trap the error?  I don't want to generate an error if I don't have
to.

Thanks,

Jim DeMarco
Director of Product Development
HealthSource/Hudson Health Plan


****************************************************************************
*******
"This electronic message is intended to be for the use only of the named
recipient, and may contain information from Hudson Health Plan (HHP) that is
confidential or privileged.  If you are not the intended recipient, you are
hereby notified that any disclosure, copying, distribution or use of the
contents of this message is strictly prohibited.  If you have received this
message in error or are not the named recipient, please notify us
immediately, either by contacting the sender at the electronic mail address
noted above or calling HHP at (914) 631-1611. If you are not the intended
recipient, please do not forward this email to anyone, and delete and
destroy all copies of this message.  Thank You".
****************************************************************************
*******

_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com


_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com


****************************************************************************
*******
"This electronic message is intended to be for the use only of the named
recipient, and may contain information from Hudson Health Plan (HHP) that is
confidential or privileged.  If you are not the intended recipient, you are
hereby notified that any disclosure, copying, distribution or use of the
contents of this message is strictly prohibited.  If you have received this
message in error or are not the named recipient, please notify us
immediately, either by contacting the sender at the electronic mail address
noted above or calling HHP at (914) 631-1611. If you are not the intended
recipient, please do not forward this email to anyone, and delete and
destroy all copies of this message.  Thank You".
****************************************************************************
*******

_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com


_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com


***********************************************************************************
"This electronic message is intended to be for the use only of the named recipient, and may contain information from Hudson Health Plan (HHP) that is confidential or privileged.  If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution or use of the contents of this message is strictly prohibited.  If you have received this message in error or are not the named recipient, please notify us immediately, either by contacting the sender at the electronic mail address noted above or calling HHP at (914) 631-1611. If you are not the intended recipient, please do not forward this email to anyone, and delete and destroy all copies of this message.  Thank You".
***********************************************************************************



More information about the AccessD mailing list