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

119
Vistas
UDP network stuck while system waiting/receiving data

I have to build up a bilateral UDP network system, that means both server and client send and receive data, as illustrated by the below diagram:

network diagram

I took a ready to use example from http://www.binarytides.com/udp-socket-programming-in-winsock/

However, on the client, when a data(string) is sent, the client gets stuck waiting for incoming data on this line: recvfrom(s, buf, BUFLEN, 0, (struct sockaddr *) &si_other, &slen)

The client cannot send more data until it receives incoming data.

Is there any method that I can keep sending data to the server, while also waiting for incoming data?

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

This is because by default sockets are blocking, which means recv and read family calls will hang until there is data available. You need to either use nonblocking I/O with multiplexing like select() or poll(), or use a separate, dedicated thread for receiving data.

Nonblocking I/O is significantly different in design from blocking I/O code, so there's not a simple change you can make. I recommend you read something like Beej's Guide to Network Programming which covers all of these issues.

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