7 years, 11 months ago.

Multiple UDPSockets in multiple Threads

Hi! I'm trying to send data from two threads simultaniously using UDPSockets. One thread does broadcast one datagram every two seconds and the other thread should send a one-shot packet to another host. However, sendTo returns -1 on the the one-shot thread. When I step into sendTo with a debugger, it shows that _sock_fd is less than zero in UDPSocket::sendTo. I made sure to properly initialize the socket and its endpoint.

Is this a known problem? How can i fix it?

Be the first to answer this question.