Connection exception

  • Replies:0
  • OpenNot stickiedUnanswered
  • Forum posts: 2

Sep 4, 2017 6:09:20 PM via Website

i have a problem.
My app exery 20 seconds send datas to a server.
The problem is that after few minutes i receive connection timeout exception and isn't a time problem.
URL webServiceURL = new URL(webServiceURLString);
wcfConnection = (HttpURLConnection) webServiceURL.openConnection();
wcfConnection.setConnectTimeout(UtilityClass.connectTimeout); // set timeout to 30 seconds
wcfConnection.setRequestProperty("Accept-Charset", charset);
wcfConnection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded;charset=" + charset);
wcfConnection.setDoOutput(true); // This triggers
OutputStream out = wcfConnection.getOutputStream();

The last instruction rise the exception.

All run right for few minutes and then rise the exception always.
On a Android 6 Samsung S5 the problem not occours.
On a Android 7 Huawei P9 lite the problem occours.

Roberto Gilli