dlucic 0 Posted yesterday at 09:38 AM I have a problem when my andoroid device lost wifi and connection broke. I can not reestablished that in ordinary maner. My andorid application have TSQLConnection object that connects to DataSnap server application. Everything works fine until I issue network problem. When wifi temporarly lost connection TSQLConnection also lost connection and I get Socket error #103 when I try to open TClientDataSet and that is OK. When I try it once again it works fine. I supose my application successfuly reconnect and open the query. But when I tryed it for the third time I have Socket error # 104. And again. Once OK another time Socket error #104. There is no problems when wifi connection is stable. What should I do? Share this post Link to post
Olli73 0 Posted yesterday at 09:57 AM (edited) It is better to use a HTTP-/Rest-Server ... You could easily fill a client dataset on client in this way: On Server you make a Query and then via a provider you load it into a clientdataset. Out of that you can use a command to make XML or JSON of it. That XML/JSON you send (as a result of a get query from client) to the client and with a command you can generate a filled ClientDataSet on Client and work then with that. The other way, to update the database on server, could be a little bit more complex. Edited yesterday at 09:58 AM by Olli73 Share this post Link to post
dlucic 0 Posted 3 hours ago Thank you but you did not understand me. I mada both server DataSnap service and client Android application. Datasnap service has connection to MS SQL Server. This is objects that I used on server side service application : On the other side, I have android application that connect's to my DataSnap server service through TSQLConnection and TDSProviderConnection. And everything works fine until I lost my wifi connection in a second. I am trying to find way to recover my android application without restarting it. So, my android appllication works fine and when wifi connection broke for a second I receive Socket error #103 when I try to open one of mine TClientDataSet's. If I try it one more time it works fine again. But when I try it for the third time I receive Socket error #104. And that goes in a round (good response, Socket error #104, good response, Socket error #104...) until I restarted my application. Share this post Link to post
Remy Lebeau 1349 Posted 2 hours ago 1 hour ago, dlucic said: So, my android appllication works fine and when wifi connection broke for a second I receive Socket error #103 when I try to open one of mine TClientDataSet's. If I try it one more time it works fine again. But when I try it for the third time I receive Socket error #104. And that goes in a round (good response, Socket error #104, good response, Socket error #104...) until I restarted my application. Why not simply catch the socket error and retry the failed operation? Share this post Link to post
dlucic 0 Posted 1 hour ago That's exactly what I tried, buti it heppens exactly as I wrote. This is code on my login form. I have procedure KonektujSe where I connect to DataSnap server service and it works fine. Than I have some code in onClick method with try except. When error occures I call KonektujSe procedure again but it doesn't work. Share this post Link to post
Olli73 0 Posted 57 minutes ago I have no experience with such a setup, but I would try to use "TDSProviderConnection.AfterDisconnect" event to start a timer which tries every second to call a "TDSProviderConnection.Open" until "TDSProviderConnection.connected" is true again. As long as the timer runs you block all actions which load or save data from/to the server. Share this post Link to post