开发者

Looking for a recommendation to use WebService in communication

i have PC that c开发者_如何学运维onnect to my WebService on the server.

what are the best recommendation to use and check if i have connection ?

if there isn't connection:

  1. to make loop for 5 times and check again ?

  2. or to make longer the time out connection ?

  3. or to send messageBox "try again" ?

what is the best thing to do ?

thanks in advance


If we're talking about winforms applications, I'll probably try a DNS lookup for a public address, a discrete button for manual retries and a Thread.Sleep to automatic checks.

If that DNS lookup works, it's time to try that web service call.

EDIT: seems possible to do a P/invoke call to check for internet connection, as described in Check Your Internet Connection With C#


That depends on what your users expect and do you expect to be the reason for the failure.

If the command you're sending to the server is some sort of periodic check, you can just try next time, and maybe write some message in the status bar.

If the most likely case is that the connection is down on the user's PC, just show a error message, retrying won't help you.

If the problem is something like overloaded server, trying again few times might be the best solution.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜