PDA

View Full Version : Server not reading



probine
7th December 2006, 14:51
For some reason this server is not reading


ClientThread::ClientThread(int socketDescriptor, QTextBrowser * textBrowser)
{
_socketDescriptor = socketDescriptor;
_textBrowser = textBrowser;
run();
}


void ClientThread::run()
{
dataIn = "";
tcpSocket = new QTcpSocket();
if(!tcpSocket->setSocketDescriptor(_socketDescriptor)){
_textBrowser->append("Error in the connection");
exit();
}
_textBrowser->append("Client successfully connected");
connect(tcpSocket, SIGNAL(readyRead()), this, SLOT(readData()));
exec();
}


void ClientThread::readData()
{
dataIn=(tcpSocket->readAll());
_textBrowser->append("Hi");
_textBrowser->append(dataIn);
}


Suggestions !!!

danadam
7th December 2006, 15:45
I'm not shure if calling run() creates a new thread. This method is just what the thread is doing when it's running. When you call start() the thread is created and it executes run() method.