void jcServeurSocket::newConnection ( int socket ) { ClientSocket *s = new ClientSocket( socket, this ); } ClientSocket::ClientSocket( int sock, QObject *parent=0, const char *name=0 ) : QSocket( parent, name ) { line = 0; connect( this, SIGNAL(readyRead()),SLOT(readClient()) ); connect( this, SIGNAL(connectionClosed()),SLOT(deleteLater()) ); setSocket(sock); } void ClientSocket::readClient() { QTextStream ts( this ); while ( canReadLine() ) { QString str = ts.readLine(); jcServeurSocket * papa=(jcServeurSocket *)parent(); FormChat * papi=((FormChat *)papa)->parent(); QString Texte_present=papi->textEdit2->text(); QString Texte_envoie=str; Texte_present+="\n"; Texte_present+=str; papi->textEdit2->setText(Texte_present); line++; } }