Hi,
I work with Poco and wxWidgets. I want to display text received from server so I'm writing the run() method of MyTCPClient class (see this topic)
But I don't understand how to do it. In java, I would have done that :
^public void run(){
try {
while ((fromServer = in.readLine()) != null) {
this.gui.display.asyncExec(new Runnable(){ // this is to be able to write text in gui
public void run() {
gui.discutionArea.insert(MyTCPClient.fromServer);
}
});
}
} catch (IOException e) {
System.err.println("niop");
}
}^
where "in" is a BufferedReader.
It doesn't seem to be the same way with Poco...
I've done it (run() function) :
^SocketStream str(sock);
str << "message from client to server" << std::flush;
StreamCopier::copyToString(str, received);
sock.shutdownSend();
if (mainGui) mainGui->setWxDiscutionText(wxString("Connection closed"));^
where "received" is a std::string which is a member of MyTCPClient class.
So, if I understand, all strings sent by the server are copied in my "received" string.
So, now, I have to make another thread to display "received" string each time it changes ?
Isn't there a better way to display incoming strings ?





