Link to home
Start Free TrialLog in
Avatar of TLevin10
TLevin10

asked on

C# Offline Mode

Hello experts,

I am creating a distributed application which utliizes a central database to manage data.  I would like allow users to store some data offline so that, in the case that they are not connected to the internet or the SQL server is down, they are still able to view existing data and perform offline functions.

There are two problems I have with this implementation.

(1) How can I check whether the user is connected to the internet or not
(2) How can I check whether the SQL server is running (assuming the user is online)

Thanks,

-T
ASKER CERTIFIED SOLUTION
Avatar of dttri
dttri
Flag of Viet Nam image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of TLevin10
TLevin10

ASKER

Hi dttri,

Thanks for the quick response.

(1) Checking Internet Connection - This is a very interesting approach and I will try it out.  Good information :)

(2) Checking SQL Server - Maybe I'm wrong, but this seems like a bit of a hack - I don't want to be constantly trying to connect to the SQL server in order to check its status, causing excess traffic.  Is there some sort of function to do this which is not a try/catch block I am executing repeatedly, or am I just responsible for wrapping all of my SQL queries in a try/catch and catching the SQL Excpetion?

Thanks
Hi TLevin10,
For the second question, I think using the way I mentioned will cost bandwidth, but it's not a bad idea ;). You can use the reverse: get SQL Server let you know that it's running by constant sending your program some signal at specific interval. But this way will cost bandwidth also! I think most of the programs using one of the ways I suggest. The different is the time interval to check. The shorter time, the more correct your get but the more traffic also. Do you know Yahoo! Messenger? I use it everyday and I think it display the online status of users by constant checking connection with them. Because of the way it check online status, it's not perfect; for example, when someone get disconnected suddenly (eg, because of power problem) it still display their status as "online" although it's not.
Interesting... I will award the points, since it seems there are a variety of solutions to the problem...
Thanks for the points TLevin10 :-)