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.