File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed
src/com/loopj/android/http Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -200,6 +200,17 @@ public void setUserAgent(String userAgent) {
200200 HttpProtocolParams .setUserAgent (this .httpClient .getParams (), userAgent );
201201 }
202202
203+ /**
204+ * Sets the connection time oout. By default, 10 seconds
205+ * @param timeout the connect/socket timeout in milliseconds
206+ */
207+ public void setTimeout (int timeout ){
208+ final BasicHttpParams httpParams = this .httpClient .getParams ();
209+ ConnManagerParams .setTimeout (httpParams , timeout );
210+ HttpConnectionParams .setSoTimeout (httpParams , timeout );
211+ HttpConnectionParams .setConnectionTimeout (httpParams , timeout );
212+ }
213+
203214 /**
204215 * Sets the SSLSocketFactory to user when making requests. By default,
205216 * a new, default SSLSocketFactory is used.
You can’t perform that action at this time.
0 commit comments