- Forum posts: 2
Sep 4, 2017, 6:09:20 PM via Website
Sep 4, 2017 6:09:20 PM via Website
Hi,
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.
code:
URL webServiceURL = new URL(webServiceURLString);
wcfConnection = (HttpURLConnection) webServiceURL.openConnection();
wcfConnection.setConnectTimeout(UtilityClass.connectTimeout); // set timeout to 30 seconds
wcfConnection.setReadTimeout(UtilityClass.readTimeout);
wcfConnection.setRequestProperty("Accept-Charset", charset);
wcfConnection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded;charset=" + charset);
wcfConnection.setDoOutput(true); // This triggers
wcfConnection.setDoInput(true);
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.
Thanks
Roberto Gilli
Recommended editorial content
With your consent, external content is loaded here.
By clicking on the button above, you agree that external content may be displayed to you. Personal data may be transmitted to third-party providers in the process. You can find more information about this in our Privacy Policy.