QTcpSocket *_sock = new QTcpSocket(this); _sockets[_data] = _sock; qDebug()<<_sockets.size(); connect(_sock,SIGNAL(readyRead()),this,SLOT(onReadyRead())); connect(_sock,SIGNAL(connected()),this,SLOT(onSockedSend())); connect(_sock,SIGNAL(error(QAbstractSocket::SocketError)),this,SLOT(onHandlerError(QAbstractSocket::SocketError))); connect(_sock, SIGNAL(disconnected()),_sock,SLOT(deleteLater()));