void ServeurTcpPull::connexionAuServeur() { DemandeTcpPull* sock = new DemandeTcpPull( nextPendingConnection(), mesImages); socks << sock; connect( sock, SIGNAL(connexionTermine(DemandeTcpPull*)), this, SLOT(deleteSock(DemandeTcpPull*)) ); }
void HttpServer::onNewConnection() { while(QTcpSocket *sock = nextPendingConnection()) { qfInfo() << "accepting connection, socket:" << sock; new HttpConnection(sock, this); } }
void HttpSocket::handleNewConnection() { DBUG; while (hasPendingConnections()) { QTcpSocket *socket = nextPendingConnection(); // prevent clients from sending too much data socket->setReadBufferSize(constMaxBuffer); static const QLatin1String constIpV6Prefix("::ffff:"); QString peer=socket->peerAddress().toString(); QString ifaceAddress=serverAddress().toString(); const bool hostOk=peer==ifaceAddress || peer==mpdAddr || peer==(constIpV6Prefix+mpdAddr) || peer==QLatin1String("127.0.0.1") || peer==(constIpV6Prefix+QLatin1String("127.0.0.1")); DBUG << "peer:" << peer << "mpd:" << mpdAddr << "iface:" << ifaceAddress << "ok:" << hostOk; if (!hostOk) { sendErrorResponse(socket, 400); socket->close(); DBUG << "Not from valid host"; return; } connect(socket, SIGNAL(readyRead()), this, SLOT(readClient())); connect(socket, SIGNAL(disconnected()), this, SLOT(discardClient())); } }
void Server::newConnection() { // Cuando se crea la conexion la enlazo agregandola a lista de conexiones if(this->Lista_Conexiones.count()<this->Cantidad_Conexiones) { Connection *con = new Connection(nextPendingConnection()); // Agregarla a la lista de conexiones int val=this->conexionesDisponibles(); qDebug()<<"Valor"<<val; if(val==-1){ qDebug()<<this->Lista_Conexiones.count()<<"aniadido"; this->Lista_Conexiones.push_back(con); con->indice_lista_conexion = this->Lista_Conexiones.count()-1; }else{ qDebug()<<"Reemplazar"<<val<<con->nick; this->Lista_Conexiones.replace(val,con); con->indice_lista_conexion=val; qDebug()<<"paso de acá"; } connect(con,SIGNAL(newProcess(Connection*,QString)),this,SLOT(procesar(Connection*,QString))); connect(con,SIGNAL(newViewer(Connection*,QString)),this,SLOT(procesarViewer(Connection*,QString))); connect(con,SIGNAL(newMovePieza(Connection*,QString)),this,SLOT(procesarMovimientoPieza(Connection*,QString))); connect(con, SIGNAL(newMessage(Connection*,QString)), this, SLOT(procesarMensaje(Connection*,QString))); connect(con, SIGNAL(newMove(Connection*,QString)), this, SLOT(procesarMovimiento(Connection*,QString))); connect(con,SIGNAL(newChallenge(Connection*,QString)),this,SLOT(procesarChallenges(Connection*,QString))); // connect(this, SIGNAL(newMessage(QString)), con, SLOT(sendMessage(QString))); connect(con, SIGNAL(connected(Connection*, QString)), this, SLOT(connected(Connection*, QString))); connect(con, SIGNAL(disconnected(Connection*, QString)), this , SLOT(disconnected(Connection*, QString))); connect(con,SIGNAL(modificarListas(Connection*,QString)),this,SLOT(procesarCambiosListas(Connection*,QString))); this->log->append("Nueva conexion..." + con->socket->peerAddress().toString()); }
void SensingServer::newClient() { QTcpSocket *client = nextPendingConnection(); if (client == 0) return; addNewClient(client); }
void IntProcServer::handleNewConnection() { if(clientConnection) return; clientConnection = nextPendingConnection(); connect(clientConnection, SIGNAL(disconnected()), this, SLOT(clientDisconnected())); connect(clientConnection, SIGNAL(readyRead()), this, SLOT(readData())); connect(clientConnection, SIGNAL(stateChanged(QAbstractSocket::SocketState)), this, SLOT(stateChanged(QAbstractSocket::SocketState))); }
void GraspitProtobufServer::onConnection() { QTcpSocket *clientQTcpSocketConnection = nextPendingConnection(); DBGA("GraspitProtobufServer::onConnection:: new connection"); GraspitProtobufConnection *newGraspitProtobufConnection = new GraspitProtobufConnection(NULL, clientQTcpSocketConnection); connect(clientQTcpSocketConnection, SIGNAL(disconnected()),newGraspitProtobufConnection, SLOT(deleteLater())); }
void ScriptEngineRemoteLocal::connected() { m_command = ""; m_server_socket = nextPendingConnection(); connect(m_server_socket, SIGNAL(readyRead()), this, SLOT(readCommand())); connect(m_server_socket, SIGNAL(disconnected()), this, SLOT(disconnected())); }
void Listener::acceptNewConnection() { QTcpSocket *socket = nextPendingConnection(); Connection *connection = new Connection(socket, this); m_connections.append(connection); qDebug() << "Adding connection" << connection; connect(connection, SIGNAL(closed(Connection *)), SLOT(removeConnection(Connection *))); }
void HttpSocket::handleNewConnection() { DBUG; while (hasPendingConnections()) { QTcpSocket *s = nextPendingConnection(); connect(s, SIGNAL(readyRead()), this, SLOT(readClient())); connect(s, SIGNAL(disconnected()), this, SLOT(discardClient())); } }
void CListenerSocket::incomingConnection(qintptr socketDescriptor) { CServerSocket * pSock = new CServerSocket(); pSock->setSocketDescriptor(socketDescriptor); connect(pSock,SIGNAL(MessageReady(QString)),this,SLOT(OnIncomingMessage(QString))); serverSockets.push_back(pSock); addPendingConnection(pSock); nextPendingConnection(); }
void LegacyPlayerListener::onNewConnection() { while (hasPendingConnections()) { QTcpSocket* socket = nextPendingConnection(); connect( socket, SIGNAL(readyRead()), SLOT(onDataReady()) ); } }
void ApplicationEventHandler::accept() { WalletLogger::debug(tr("[Application event handler] New socket connection.")); QLocalSocket* socket = nextPendingConnection(); if (socket == nullptr) { return; } connect(socket, &QLocalSocket::readyRead, this, &ApplicationEventHandler::readyRead); connect(socket, &QLocalSocket::disconnected, socket, &QLocalSocket::deleteLater); }
void PlayerListener::onNewConnection() { while (hasPendingConnections()) { QObject* o = nextPendingConnection(); connect( o, SIGNAL(readyRead()), SLOT(onDataReady()) ); connect( o, SIGNAL(disconnected()), o, SLOT(deleteLater()) ); } }
void MonServeur::newClientConnection() { QTcpSocket *newClient = nextPendingConnection(); qDebug() << "New Client "; _clients << newClient; connect(newClient,SIGNAL(readyRead()),this,SLOT(dataIncoming())); connect(newClient,SIGNAL(disconnected()),this,SLOT(clientDisconnected())); }
void IdentServer::incomingConnection() { auto server = qobject_cast<QTcpServer*>(sender()); Q_ASSERT(server); while (server->hasPendingConnections()) { QTcpSocket* socket = server->nextPendingConnection(); connect(socket, &QIODevice::readyRead, this, &IdentServer::respond); connect(socket, &QAbstractSocket::disconnected, socket, &QObject::deleteLater); } }
void ManaChatServer::addConnection() { qDebug() <<"new connect"; QTcpSocket* connection = nextPendingConnection(); connections.append(connection); QBuffer* buffer = new QBuffer(this); buffer->open(QIODevice::ReadWrite); buffers.insert(connection, buffer); connect(connection, SIGNAL(disconnected()), SLOT(removeConnection())); connect(connection, SIGNAL(readyRead()), SLOT(receiveMessage())); }
void StatusApi::slotNewConnection() { while (hasPendingConnections()) { QWebSocket *sock=nextPendingConnection(); DBUG << (void *)sock; connect(sock, SIGNAL(disconnected()), this, SLOT(clientDisconnected())); clients.append(sock); sock->sendTextMessage(statusMessage()); sock->sendTextMessage(currentSongMessage()); } }
void ConnectionServer::handleNewConnection() { QLocalSocket *localSocket(nextPendingConnection()); ipcClientProxies.emplace_back(ipcServer, localSocket); ipcServer->addClient(&ipcClientProxies.back()); localSockets.push_back(localSocket); emit newConnection(); }
void TNotificationServer::handleNewConnection(){ while(hasPendingConnections()){ QTcpSocket *tcpCon = nextPendingConnection(); if(tcpCon!=0){ TConnection *con = new TConnection; con->connection = tcpCon; con->lastActive = QDateTime::currentDateTime(); activeConnections << con; } } waitForNewConnection(); }
void Genesis::establishConnection() { // qDebug() << "establishConnection"; QLocalSocket *clientConnection = nextPendingConnection(); connect(clientConnection, SIGNAL(disconnected()), clientConnection, SLOT(deleteLater())); connect(clientConnection, SIGNAL(readyRead()), this, SLOT(readClientData())); _blockSize = 0; clientConnection->waitForReadyRead(-1); }
void LocalServer::acceptConnection() { uINFO << "client connected"; emit requestShowWindow(); m_tcpServerConnection = nextPendingConnection(); connect(m_tcpServerConnection, SIGNAL(readyRead()), SLOT(handleMessage())); connect(m_tcpServerConnection, SIGNAL(error(QAbstractSocket::SocketError)), SLOT(handleConnectionError(QAbstractSocket::SocketError))); m_tcpServerConnection->write((Globals::BUFFER_DIRECTORY + "\n").toLatin1()); QVariantMap map; map.insert("CONNECTED", true); emit messageReceived(QtJson::serialize(map)); }
void Server::aggiungiNuovaConnessione() { QTcpSocket* connection; QBuffer* buffer; connection = nextPendingConnection(); //Aggiungo la nuova connessione con il client. connections.append(connection); //Aggiungo questa connessione alla lista delle connessioni. buffer = new QBuffer(this); buffer->open(QIODevice::ReadWrite); buffers.insert(connection, buffer); connect(connection, SIGNAL(disconnected()), SLOT(rimuoviConnessione())); connect(connection, SIGNAL(readyRead()), SLOT(riceviMessaggio())); }
void rc_server::addConnection() { QTcpSocket* connection = nextPendingConnection(); qDebug() << "<rc_server>: I have accepted a new connection request."; connections.append(connection); QBuffer* buffer = new QBuffer(this); buffer->open(QIODevice::ReadWrite); /* buffers is of <QHash> datatype, ie. with connection object used as the key. This is a good idea to store information from different connected clients in an organized way.*/ buffers.insert(connection, buffer); connect(connection, SIGNAL(disconnected()), SLOT(removeConnection())); connect(connection, SIGNAL(readyRead()), SLOT(receiveMessage())); }
void CProxy::slotNewConnection() { QTcpSocket * h; while ( h = nextPendingConnection() ) { QLOG_INFO() << "new pending connection"; connect( h, SIGNAL(readyRead()), this, SLOT(slotHostDataAvailable()) ); connect( h, SIGNAL(disconnected()), this, SLOT(slotDisconnected()) ); QTcpSocket * c = new QTcpSocket( this ); connect( c, SIGNAL(readyRead()), this, SLOT(slotClientDataAvailable()) ); connect( c, SIGNAL(disconnected()), this, SLOT(slotDisconnected()) ); c->connectToHost( m_clientHost, m_clientPort ); m_hostKey.insert( h, c ); m_clientKey.insert( c, h ); } }
/*! \fn CServer::newIternfaceConnection() */ void CServer::newInternfaceConnection() { QTcpSocket *socket = nextPendingConnection () ; //! filter the connection QSqlQuery query("SELECT COUNT(ip) FROM hr_accessLink_Interface WHERE ip='" + socket->peerAddress().toString() + "'"); query.next(); if(query.value(0).toInt()>0) emit newConnection(socket); else { socket->close(); socket->deleteLater(); } }
void O2ReplyServer::onIncomingConnection() { qDebug() << "O2ReplyServer::onIncomingConnection: Receiving..."; QTcpSocket *socket = nextPendingConnection(); connect(socket, SIGNAL(readyRead()), this, SLOT(onBytesReady()), Qt::UniqueConnection); connect(socket, SIGNAL(disconnected()), socket, SLOT(deleteLater())); // Wait for a bit *after* first response, then close server if no usable data has arrived // Helps with implicit flow, where a URL fragment may need processed by local user-agent and // sent as secondary query string callback, or additional requests make it through first, // like for favicons, etc., before such secondary callbacks are fired QTimer *timer = new QTimer(socket); timer->setObjectName("timeoutTimer"); connect(timer, SIGNAL(timeout()), this, SLOT(closeServer())); timer->setSingleShot(true); timer->setInterval(timeout() * 1000); connect(socket, SIGNAL(readyRead()), timer, SLOT(start())); }
void Server::newConnection() { // Cuando se crea la conexion la enlazo agregandola a lista de conexiones Connection *con = new Connection(nextPendingConnection()); // Agregarla a la lista de conexiones this->Lista_Conexiones.push_back(con); // Decirle a la conexion en que posicion de la lista la agregaron con->indice_lista_conexion = this->Lista_Conexiones.count()-1; connect(con, SIGNAL(newMessage(Connection*,QString)), this, SLOT(procesarMensaje(Connection*,QString))); // connect(this, SIGNAL(newMessage(QString)), con, SLOT(sendMessage(QString))); //connect(con, SIGNAL(connected(Connection*, QString)), this, SLOT(connected(Connection*, QString))); // connect(con, SIGNAL(disconnected(Connection*, QString)), this , SLOT(disconnected(Connection*, QString))); this->log->append("Nueva conexion..." + con->socket->peerAddress().toString()); }
void QTNServer::onNewConnection() { // sending welcome message to the client QTcpSocket* clientConnection = nextPendingConnection(); if (clientConnection) { // check if we are reaching num max of clients connected if (m_clients.size() < m_numMaxClients) { // very lightweight task ready to use, will not allocate OS Thread QTNServerThread* serverTask = new QTNServerThread(clientConnection->socketDescriptor(), this); m_clients[clientConnection->socketDescriptor()] = serverTask; QThreadPool::globalInstance()->start(serverTask); } else { clientConnection->disconnectFromHost(); } } }
void CLCServer::readConnection() { QTcpSocket * sock = nextPendingConnection(); sock->waitForReadyRead(); QByteArray b = sock->readLine(); if(b.isEmpty()) return; const char * cmd = b.data(); Arguments * a = parse_commandline(cmd); QStringList l; l << "CLCBrowser"; for(int i=1 ; i<a->argc ; ++i) { l << a->argv[i]; } Arguments_destroy(a); parseArgs(l, sock); sock->close(); }