Pergunta

i use web service to exchange data betwen c# client and php server to check data change. But i must request continus to hosting but if i do that the server will be overload.

 WebClient cGet = new WebClient();
cGet.DownloadString(loptinh.domain+"postandroid.php?res=00000tt" + loptinh.id);

does it have any ways like the using GCM in android or another ?

Foi útil?

Solução

Do you need a pinpoint precision? Do you need the message exactly the moment when it arrives at the server?

Because if that's not the case, the easiest way to resolve this error is to check the server only every few seconds/minutes to prevent unnecessary traffic. You'd have some delays between detection of the message though.

If the answer is yes, well then it's a bit harder.
If you have access to the server, it would be (probably) the best scenario. You'd just write yourself an application for the server that would check the database locally and if a message arrives, send a notification to your application. Your local application and the server application could remain connected to get the notification as soon as possible.

If you don't have access to the server, well, I can't think of a way how to make this work for you. The server doesn't seem to allow/support persistent connection. Maybe I'm wrong and hopefully someone else could provide a better solution...

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top