Hi!
AT the moment i'm trying to develop a server with Qt and a client in java. But thing don't work as i like. I'm even having troubles receiving a string with my Qt server.
Here is a little bit of code:
The important part of my java client:
public boolean sendString(){
try{
final PrintWriter pw = new PrintWriter(mSocket.getOutputStream(), true);
pw.println("Test String");
return true;
} catch(Exception e){
// to be coded
return false;
}
}
public boolean sendString(){
try{
final PrintWriter pw = new PrintWriter(mSocket.getOutputStream(), true);
pw.println("Test String");
return true;
} catch(Exception e){
// to be coded
return false;
}
}
To copy to clipboard, switch view to plain text mode
and here my qt part:
[...]
QTcpSocket clientConnection
= tcpServer
->nextPendingConnection
();
connect(clientConnection, SIGNAL(readyRead()), this, SLOT(readClient()));
[...]
void Server::readClient(void)
{
ui.clientLabel->setText(tr("entered readClient"));
}
[...]
QTcpSocket clientConnection = tcpServer->nextPendingConnection();
connect(clientConnection, SIGNAL(readyRead()), this, SLOT(readClient()));
[...]
void Server::readClient(void)
{
ui.clientLabel->setText(tr("entered readClient"));
}
To copy to clipboard, switch view to plain text mode
Now, my problem is, that readClient() isn't even called. So I think the SIGNAL(readyRead()) is never executed.
I suspect that I can't send a String like this. But what do I do wrong?
Thanks,
Bernie
Bookmarks