コード例 #1
0
TNotificationServer::TNotificationServer(QObject *parent) :  QTcpServer(parent) {
	//timer = new QTimer;
	//connect(timer,SIGNAL(timeout()),this,SLOT(handleTimer()));
	//timer->start(TIMER_PERIOD);

	listen(QHostAddress::Any, OUT_SOCKET_PORT);
	connect(this,SIGNAL(newConnection()),this,SLOT(handleNewConnection()));
	waitForNewConnection();
}
コード例 #2
0
ServeurTcpPull::ServeurTcpPull( const QString& pathFlux, int port):
    QTcpServer()
{
    chargerVideo( pathFlux );
    connect(this, SIGNAL(newConnection()),
            this, SLOT(connexionAuServeur()) );

    listen( QHostAddress::Any, port );
    waitForNewConnection();
    //attend une connection
}
コード例 #3
0
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();
}
コード例 #4
0
ServeurUdpPull::ServeurUdpPull(): QTcpServer()
{
    sockecoute = new QUdpSocket;
    chargerVideo();
    sockecoute->bind(QHostAddress::Any, 11114, QUdpSocket::ShareAddress);
    //sock lié au port de 11114 ecoutant depuis toutes les adresses
    // et plusieurs a la fois
    connect(sockecoute, SIGNAL(readyRead()), this, SLOT(requeteRecu()));

    waitForNewConnection();

    //attend une connection
}