SFML community forums

Help => Network => Topic started by: r4gTime on April 20, 2020, 09:33:27 am

Title: Non-blocking UDP socket doesn't receive any data
Post by: r4gTime 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 !