httpClient : Unable to read data from the transport connection:Connection reset by peer

Hello all,
i have a web api applicaiton where we can call by a device under android 6.0
All works fine, but last week we have a problem and i don't know why ...

Here is it the code of the web api call on device android :

`
static async Task DownloadDatas(string url)
{
string jsonDatas = string.Empty;
try
{
using (var client = new HttpClient())
{
using (var r = await client.GetAsync(new Uri(url)))
{
jsonDatas = await r.Content.ReadAsStringAsync();
}
}
}
catch (Exception ex)
{
Console.Write(ex);
}

        return jsonDatas;
    }

`
If i call the url with a browse i can download the json string but every time with the android device i have this error
Unable to read data from the transport connection:Connection reset by peer

Any idea, suggestion or so on would be appreciate ...

actually it's not possible to reproduce the problem and of course it's difficult to investigate ...

thanks

Answers

  • BohirBohir TJMember ✭✭

    Hi did you solve this ?

  • BohirBohir TJMember ✭✭

    In my case this happening only with android.

  • ChristopheBERNARDChristopheBERNARD BEMember ✭✭✭✭

    hello @bohir,
    it"s a problem about the network ...
    because with a browser i can download the json every time but on the SPECIFIC wifi with device ... the call crash !

    i'm always wait the solution about it ..and of course what's happen ..
    is it possible to you to try with your call web service in gprs ?

  • BohirBohir TJMember ✭✭

    Yes u're right, it seems like network problem, I was getting this exception not always(sometimes), no sorry I'm using 4g LTE company's net, it's not possible me to do that.

  • ChristopheBERNARDChristopheBERNARD BEMember ✭✭✭✭

    Hello @bohir => yes i think you have the same problem as ours ..
    good luck for to find a solution

Sign In or Register to comment.