Solved

C# Offline Mode

Posted on 2006-06-19
5
985 Views
Last Modified: 2008-02-26
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
0
Comment
Question by:TLevin10
  • 3
  • 2
5 Comments
 
LVL 7

Accepted Solution

by:
dttri earned 250 total points
ID: 16935832
Greetings,
(1): You can check internet connection with this:
http://www.codeproject.com/cs/internet/internetconnection_status.asp
(2): To check the SQL Server is running or not, just connect to it (assume that your internet connection is OK) using a username and password and get the result back.

Hope this help
0
 

Author Comment

by:TLevin10
ID: 16936681
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
0
 
LVL 7

Expert Comment

by:dttri
ID: 16949032
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.
0
 

Author Comment

by:TLevin10
ID: 16951538
Interesting... I will award the points, since it seems there are a variety of solutions to the problem...
0
 
LVL 7

Expert Comment

by:dttri
ID: 16952840
Thanks for the points TLevin10 :-)
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Najam
Having new technologies does not mean they will completely replace old components.  Recently I had to create WCF that will be called by VB6 component.  Here I will describe what steps one should follow while doing so, please feel free to post any qu…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now