|
-
Sep 26th, 2002, 05:23 PM
#1
Thread Starter
New Member
How to detect when the client is back online
The application that I am trying to build basically try to do this:
Each time the user updates a record, the app will check to see if the machine is online (LAN, internet, etc). If it is online, it will send the record to the server, if it is not online, then it will save it locally and when the user goes online, it will send the record to the server.
So I am thinking to send the data to the server. If that fails, then I can assume that the user is offline or the server is down, which is the same in my situation. Now the main problem is how to know when the user is back online. There must be a system event that gets fired when you go online. I am trying to know the name of that event and how to use it. I appreciate your help.
-
Sep 26th, 2002, 05:26 PM
#2
PowerPoster
Well
VB Code:
Private Declare Function InternetGetConnectedState Lib "wininet.dll" (ByRef lpSFlags As Long, ByVal dwReserved As Long) As Long
If InternetGetConnectedState(0, 0) Then
MsgBox "Online"
Else
MsgBox "Offline"
End If
Remaining quiet down here !!!
BRAD HAS GIVEN ME THE ULTIMATIVE. I have chosen to stay....
-
Sep 26th, 2002, 05:45 PM
#3
Thread Starter
New Member
So do I need to call "InternetGetConnectedState" all the time in order to know when the machine is back online?
-
Sep 26th, 2002, 05:46 PM
#4
PowerPoster
Well
My idea would be to check when database is to be updated.
If online update as such.
If offline, update locally.
When application is started, check to see if connected, if so , update the main database form the local copy...
Remaining quiet down here !!!
BRAD HAS GIVEN ME THE ULTIMATIVE. I have chosen to stay....
-
Sep 26th, 2002, 06:24 PM
#5
Thread Starter
New Member
Thanks James. I tried your code and it works. I am using windows XP. Do you know if most windows versions have "wininet.dll" ?
-
Sep 26th, 2002, 06:39 PM
#6
PowerPoster
Well
Good question. I mainly develop for NT/2000 client so I couldn't answer. Perhaps try posting in the General Vb Questions area?
Glad I could help (sort of )
Remaining quiet down here !!!
BRAD HAS GIVEN ME THE ULTIMATIVE. I have chosen to stay....
-
Sep 28th, 2002, 07:43 PM
#7
PowerPoster
Well
Did you reslove this issue?
Remaining quiet down here !!!
BRAD HAS GIVEN ME THE ULTIMATIVE. I have chosen to stay....
-
Sep 30th, 2002, 02:35 PM
#8
Thread Starter
New Member
I didn’t have the time to work on it but I will post to the issue on general discusion for VB.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|