TimeOut exception while pinging the server in our clients wifi, not happening in other wifi or LTE

I have developed an app using Xamarin.Forms cross platform app. I am using following code to check whether my server is available or not.

HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);

            request.Timeout = 8000;
            request.Method = "HEAD";

            try
            {
                using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
                {
                    if (response == null || response.StatusCode != HttpStatusCode.OK)
                    {
                        return false;
                    }
                    else
                    {
                        return true;
                    }

                }
            }
            catch (WebException)
            {
                return false;
            }

Above code throwing TimeOut Exception in our client's wifi setup, but it is working fine in our wifi. When client is using LTE, then TimeOut exception is not happening.

I tries setting KeepAlive, TimeOut.Infinite and few other things given in other SO threads, related to this issue. Changed pinging code also, nothing is working.

What is going wrong here?

Answers

  • DaveHuntDaveHunt USMember ✭✭✭✭✭

    Are they able to access your web server using a browser? If not, then it's likely a problem with the clients network setup and not with your app.

  • SubhaMuralidharan.6484SubhaMuralidharan.6484 USMember
    edited August 2016

    @DaveHunt
    Yes, Using client's wifi I am unable to open our webserver in Safari browser, iOS device.

    But same thing is working fine in Android with client's wifi.

    Now the problem is where?

    Happening only in iOS not in Andorid, I am using Forms only.

  • DaveHuntDaveHunt USMember ✭✭✭✭✭

    If it doesn't work in Safari, but it does work in an Android browser, then it's not your app. It would have to be something in the phone's wifi configuration. Since I don't know how they're connecting to their wifi (direct, VPN, etc), I can't say what that something would be.

  • SubhaMuralidharan.6484SubhaMuralidharan.6484 USMember
    edited August 2016

    @DaveHunt,

    Thanks for your response, one more thing what we have found is immediate switching of wifi only causing this problem. If I turn off completely one wifi and turning client's wifi, server is pinging, but if I try to switch to other wifi, again coming back to client's wifi, not pinging the server at all, even after removing the app from recent list.

    We are confused of this strange behavior.

Sign In or Register to comment.