Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

285
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda