Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

122
Visualizações
getsockopt SO_RECVBUF after doing a set shows double the value in linux?

When calling setsockopt with SO_RECVBUF, then turning around and calling getsockopt with SO_RECVBUF, it appears to be telling me that it sets the buffer size to twice what I requested it to be set to. Anybody know why that may be?

code in question:

https://gist.github.com/rdp/8443238

output:

setting it as 2222
[udp @ 0x1a72ec0] end receive buffer size reported is 4444

Only in linux, on other OS's seem to report it as the value I set it to. Thank you.

over 4 years ago · Santiago Trujillo
2 Respostas
Responde à pergunta

0

Excerpt from Linux man page for socket

SO_SNDBUF

Sets or gets the maximum socket send buffer in bytes. The kernel doubles this value (to allow space for bookkeeping overhead) when it is set using setsockopt(2), and this doubled value is returned by getsockopt(2). The default value is set by the /proc/sys/net/core/wmem_default file and the maximum allowed value is set by the /proc/sys/net/core/wmem_max file. The minimum (doubled) value for this option is 2048.

So, kernel doubles the value you set for it's internal purpose.

over 4 years ago · Santiago Trujillo Relatório

0

The platform can adjust the value you supply up or down. See the man page. You were below the platform minimum.

2222 is far too low. It should be more like 32k.

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda