问题
I'm using Apache HttpClient 4.3.x and was wondering if there's a way too see what is the current value for the socket buffer size used by it to send/receive data and if it's possible for me to change it?
回答1:
I have not found a way to see the current value, but if you haven't provided a ConnectionConfig
when building your HttpClient
, it uses ConnectionConfig.DEFAULT
which has a bufferSize
of 8192
.
You can specify a custom buffer size when building your HttpClient
. For example,
int bufferSize = 42;
ConnectionConfig config = ConnectionConfig.custom().setBufferSize(bufferSize).build();
CloseableHttpClient httpClient = HttpClientBuilder.create()
.setDefaultConnectionConfig(config)
.build();
来源:https://stackoverflow.com/questions/21946631/is-there-a-way-to-see-what-the-current-value-and-change-it-for-the-socket-buffer