2 Attachment(s)
prolem with threadedfortuneserver using QMainWindow instread dialog
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().toStdStrin g()<<" at port "<<server.serverPort()<<endl;
}
Re: prolem with threadedfortuneserver using QMainWindow instread dialog
What do you mean with "it seems connected"?
Do you get your log output?
Cheers,
_
Re: prolem with threadedfortuneserver using QMainWindow instread dialog
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.!!!
Re: prolem with threadedfortuneserver using QMainWindow instread dialog
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,
_
Re: prolem with threadedfortuneserver using QMainWindow instread dialog
I call the runserver function via a pushbutton which written in ui_ui.h file .
connect(runserverButton, SIGNAL(clicked()), this, SLOT(runserver()));
Re: prolem with threadedfortuneserver using QMainWindow instread dialog
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,
_
3 Attachment(s)
Re: prolem with threadedfortuneserver using QMainWindow instread dialog
It works know, I think I did a mistake somewhere I attached also my code. Thanks a lot for trying to help me.