PDA

View Full Version : prolem with threadedfortuneserver using QMainWindow instread dialog



bachir_elec
12th December 2013, 08:28
Hi I am new qt programming, I tried to use threadedfortune example it works fine but, when I replace the dialog class by QMainWindow (ui) the program doesn't work?
any idea I did not change the code of fortuneserver.* and fortunethread.*, I just repace dialog.* by ui.*
when I run it, it seems connected but not responding
any help thanks.


void ui::runserver()
{
QHostAddress hostadd("127.0.0.1");
if (!server.listen(hostadd,20000)) {
cout<<"Threaded Fortune ServerUnable to start the server: %1."<<server.errorString().toStdString()<<endl;
close();
return;
}

cout<<server.serverAddress().toString().toStdString()<<" at port "<<server.serverPort()<<endl;
}

anda_skoa
12th December 2013, 10:18
What do you mean with "it seems connected"?
Do you get your log output?

Cheers,
_

bachir_elec
12th December 2013, 10:34
I meant that the server listening but not responding to the client request, in fact when I run the client and a ask for a new fortune, the push button becomes disable, I guess the incomingConnection function doesn't responde to the client request.!!!

anda_skoa
12th December 2013, 14:12
The you probably have to debug that FortuneServer class of yours.

I am already puzzled that you got it to listen, runserver() doesn't seem to be called in the code you've posted.

Cheers,
_

bachir_elec
12th December 2013, 16:34
I call the runserver function via a pushbutton which written in ui_ui.h file .

connect(runserverButton, SIGNAL(clicked()), this, SLOT(runserver()));

anda_skoa
13th December 2013, 09:38
Right, that was to be expected. But since that is not part of the code you posted it means that the code is not what you are actually using.

I am not sure why you are asking for help while not providing enough information to do so.

Cheers,
_

bachir_elec
14th December 2013, 14:43
It works know, I think I did a mistake somewhere I attached also my code. Thanks a lot for trying to help me.