Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Non-blocking UDP socket doesn't receive any data  (Read 3216 times)

0 Members and 1 Guest are viewing this topic.

r4gTime

  • Newbie
  • *
  • Posts: 14
    • View Profile
    • Email
Non-blocking UDP socket doesn't receive any data
« on: April 20, 2020, 09:33:27 am »
Hi, I'm wondering why when I put my socket in non-blocking I don't receive anything ?

When I send data to this socket, the following code works :
broadcastSocket.setBlocking(true);
            broadcastSocket.bind(52001);
            if(broadcastSocket.receive(udpp,ip,port) == sf::Socket::Done)
            cout << "Data received" << endl;

but this one doesn't :
broadcastSocket.setBlocking(false);
            broadcastSocket.bind(52001);
while(1)
{
            if(broadcastSocket.receive(udpp,ip,port) == sf::Socket::Done)
            cout << "Data received" << endl;
}

Thanks for your help !

 

anything