3 years, 4 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?

Comment on this question
Be the first to answer this question.

You need to log in to post a question