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

290
Visualizações
How does the SO_RCVBUF size correlate to incoming packet size?

Does setting the socket receive buffer to a specified number of bytes, directly correlate to how many sized messages can be stored?

Example:
If a 100 byte message is being continuously sent over UDP to a socket buffer set at 4,000 bytes, can I expect the buffer to be able to hold 40 messages?

I thought that setting the buffer size, like so:

int size = 4000;
setsockopt(id, SOL_SOCKET, SO_RCVBUF, (char *)&size, sizeof(size));  

and letting the buffer fill from incoming packets, would result in a buffer containing 40 messages.

After turning off the UDP sender, and processing the buffer, that is not what I have observed.
Despite my messages being 100 bytes, it seems as though a 4,000 byte buffer could only hold about 4 messages.


How could 100 byte messages be taking up 1,000 bytes in the buffer?
Does this make sense? What is causing this, and how can I calculate a buffer size in accordance to how many messages can be held?


edit: duplicated question does not solve my problem.
The user there was calling setsockopt incorrectly.
I'm trying to find documentation that describes the relationship between a socket recieve buffer, and the number of sized messages that can actually be held.

over 4 years ago · Santiago Trujillo
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