Is there a way to see what the current value and change it for the socket buffer size used by Apache Http Client?

StackOverflow https://stackoverflow.com/questions/21946631

  •  14-10-2022
  •  | 
  •  

Pregunta

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?

¿Fue útil?

Solución

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();
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top