Regarding the difference between the three Timeouts in Java's HttpClient

When using Apache's HttpClient, I can set the following three timeout values (milliseconds), but I didn't understand the difference well, so I tried to summarize them myself.

import org.apache.http.client.HttpClient;
import org.apache.http.client.config.RequestConfig;

RequestConfig config = RequestConfig.custom()
    .setConnectTimeout(30000)
    .setConnectionRequestTimeout(30000)
    .setSocketTimeout(30000)
    .build();
      
HttpClient httpClient = HttpClients.custom()
    .setDefaultRequestConfig(config)
    .build();

ConnetionTimeout The timeout value for sending a connection request to the server and receiving a response that the connection has been established. In short, set the time allowed for a connection to be established with a 3-way handshake.

ConnectionRequestTimeout The timeout value after the above connection is completed until the request is sent to the server and the response is returned.

SocketTimeut A timeout value used to monitor socket communication. Packets are continuously received in socket communication, but if the reception interval is longer than this value, a timeout (= SocketTimeoutException) occurs.

Recommended Posts

Regarding the difference between the three Timeouts in Java's HttpClient
About the difference between classes and instances in Ruby
Calculate the difference between numbers in a Ruby array
About the difference between "(double quotation)" and "single quotation" in Ruby
Find the difference between List types
Output the difference between each field of two objects in Java
Understand the difference between each_with_index and each.with_index
[Rails] Difference in behavior between delegate and has_many-through in the case of one-to-one-to-many
Understand the difference between int and Integer and BigInteger in java and float and double
The application absorbs the difference in character code
Difference between final and Immutable in Java
Difference between pop () and peek () in stack
Difference between getText () and getAttribute () in Selenium
About the difference between irb and pry
Difference between "|| =" and "instance_variable_defined?" In Ruby memoization
Difference between EMPTY_ELEMENTDATA and DEFAULTCAPACITY_EMPTY_ELEMENTDATA in ArrayList
Difference between int and Integer in Java
[Ruby] Difference between methods with and without self in the class. About class methods and instance methods.
[Java] Understand the difference between List and Set
[iOS] Understand the difference between frame and bounds
[Android] Easily calculate the difference between two dates
Difference between next () and nextLine () in Java Scanner
Understand the difference between abstract classes and interfaces!
What is the difference between SimpleDateFormat and DateTimeFormatter? ??
Understand in 3 minutes! A very rough explanation of the difference between session and cookie