C++ (Qt)void socket_thread::run(){ QTcpSocket socket; if (!socket.setSocketDescriptor(descriptor)) { emit signalSocketError(socket.peerAddress().toString(),"error"); return; } ...
C++ (Qt)void socket_thread::run(){ QTcpSocket socket; if (!socket.setSocketDescriptor(descriptor)) { emit signalSocketError(socket.peerAddress().toString(),"error"); return; } socket_coming com(&socket); connect(&com,SIGNAL(socketReadyWriteSignal(QString)),this,SLOT(slotComingReadyWrite(QString))); connect(this,SIGNAL(signalComingWrite(QString,QString)),com,SLOT(slotWrite(QString,QString))); connect(&com,SIGNAL(signalUpdateTerminals(QString,QString)),this,SLOT(slotUpdateTerminals(QString,QString))); connect(&com,SIGNAL(signalClearTerminals(QString,QString)),this,SLOT(slotClearTerminals(QString,QString))); connect(&com,SIGNAL(signalError(QString,QString)),this,SLOT(slotSocketError(QString,QString))); connect(&com,SIGNAL(socketDisconnected()),this,SLOT(closeThread())); exec();} socket_thread::~socket_thread(){}