SFML community forums

Help => Network => Topic started by: lorence30 on November 15, 2015, 11:02:50 am

Title: sf::SocketSelector::wait() bug
Post by: lorence30 on November 15, 2015, 11:02:50 am
ive been fixing this for few hours:

this first snippet should output "Test" if a client is attempting to connect to server or a client is sending a packet, but it doest output "Test"
void ServerManager::socketSignal()
{
    if ( selector.wait() )
    {
        qDebug() << "Test";
        if ( selector.isReady(server) )
        {
            acceptClient();
        }
        else
        {
            receiveAndSendPacket();
        }
    }
}

MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    ServerManager server;
    while(true)
    {
        server.socketSignal();
    }
}
 

when i do this:
it works
int main()
{
    while(true)
    if ( selector.wait( ) )
    {
        qDebug() << "test";
    }

}

i dont know whats happening.
in the first snippet i tested if socketSignal() is executing, and yes its executing.
Title: Re: sf::SocketSelector::wait() bug
Post by: eXpl0it3r on November 15, 2015, 04:56:21 pm
Start Wireshark and check what is being sent (or not sent).

Additionally I think we have told you before, unless you provide a minimal but compilable example, there's little we can do to help you... ;)