1
Answer

Client and Server

Photo of Carlos Sanchez

Carlos Sanchez

20y
2.4k
1
I'doing 2 applications installed in different hosts (Client n' Server). Both works on SQL Server. When there is no problem with the network connection the Client send data to the Server, but when there is a problem, the data are stored locally (in the Client) and when the connection is fine again, the data in the client are sent to the server. My problem is: How can I know when the connection is fine again? thanx in advance.

Answers (1)

0
Photo of Carlos Sanchez
NA 264 0 20y
I'm using the below code in the Client. public bool IsAvailableServerConnection() { try{ ServerConnection.Open(); //Connection with the DB in Server return true; } catch{ return false; } } When the connection is broken a timer is enabled, this timer has the next code: private void tmrChecarConexion_Tick(object sender, System.EventArgs e) { if (!IsAvailableServerConnection()) //If connection keep broken return; //Update the Server } Troubleshoot: If I disconnected the network cable from the Client, the timer would be enbled. and if 2 minutues later I connected the network cable, the application would work fine. But, when the cable keep disconnected during 1 hour and up, it doesn't work (the method return false). I don't know why. Any one can help me? I know is complicate to shoot, but if u have another way or another idea to do this I'd appreciate your help. thanx in advance.
Next Recommended Forum