Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Socket Timeout Exception #29

Open
Kishankondhiya opened this issue May 26, 2016 · 1 comment
Open

Socket Timeout Exception #29

Kishankondhiya opened this issue May 26, 2016 · 1 comment

Comments

@Kishankondhiya
Copy link

URL url = new URL(task.url);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setConnectTimeout(1000);
connection.setReadTimeout(1000);

in AsyncWorker.class having above code throws socket time out exception
and download stops after few moments

whenever i made below changes in above code it works well sometimes and after sometime again facing same problem

URL url = new URL(task.url);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setConnectTimeout(60000);
connection.setReadTimeout(60000);

Using MotoG3 for testing device android MarshMallow 6.0.1

@SayoojDev
Copy link

Its becoz either your internet connection is slow or your file server taking time to respond.

connection.setConnectTimeout(1000); connection.setReadTimeout(1000);

When you put these line you are actually setting file read time out for the connection so if the read responce doesn't come in 1 sec this will throw time out exception. Please check your connection speed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants