Server::Server(quint16 port) : socket(this) { socket.bind(port); connect(&socket, SIGNAL(readyRead()), this, SLOT(readPendingDatagrams())); }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { conta_pacote=0; ui->setupUi(this); ui->Plot_Window->setRenderHint(QPainter::HighQualityAntialiasing); ui->Plot_Window->scale(2,2); Address_Transmit = QHostAddress("10.0.27.67"); Address_Receive = QHostAddress("10.0.27.52"); Address_Multicast = QHostAddress("224.0.0.1"); udpSocket = new QUdpSocket(this); udpSocket->bind(Address_Receive,COMPORT, QUdpSocket::ShareAddress); connect(udpSocket,SIGNAL(readyRead()),this,SLOT(readPendingDatagrams())); udpSocketimagem = new QUdpSocket(this); udpSocketimagem->bind(Address_Multicast,DATAPORT, QUdpSocket::ShareAddress); udpSocketimagem->joinMulticastGroup(Address_Multicast); connect(udpSocketimagem,SIGNAL(readyRead()),this,SLOT(readPendingData())); setWindowTitle(tr("Morpheus")); resize(1240, 800); ui->tabWidget->setCurrentIndex(0); read_omr(); }
void DLockManager::initSocket() { udpSocket.bind(port); qDebug("Server listening!"); connect(&udpSocket, SIGNAL(readyRead()), this, SLOT(readPendingDatagrams())); }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); sender=new QUdpSocket(0); for(int i=0;i<2000;i++) { if(sender->bind(QHostAddress::Null, i+TARGETHOSTPORT) == true) // 绑定端口,7001 开始 { ui->label_2->setText(QString::number(i+TARGETHOSTPORT)); connect(sender, SIGNAL(readyRead()),this, SLOT(readPendingDatagrams())); break; } if(TARGETHOSTPORT+2000<=i) // 申请不到端口,退出程序 { //exit ; } } longerList = (QStringList() << "1287370402" << "1287370388" ); ui->comboBox->addItems(longerList); connect(&m_timer, SIGNAL(timeout()), SLOT(timeout()) );//5 秒1个心跳包 m_timer.start(5000); }
AssignmentClient::AssignmentClient(int &argc, char **argv, Assignment::Type requestAssignmentType, const HifiSockAddr& customAssignmentServerSocket, const char* requestAssignmentPool) : QCoreApplication(argc, argv), _requestAssignment(Assignment::RequestCommand, requestAssignmentType, requestAssignmentPool), _currentAssignment(NULL) { // register meta type is required for queued invoke method on Assignment subclasses // set the logging target to the the CHILD_TARGET_NAME Logging::setTargetName(ASSIGNMENT_CLIENT_TARGET_NAME); // create a NodeList as an unassigned client NodeList* nodeList = NodeList::createInstance(NODE_TYPE_UNASSIGNED); // set the custom assignment socket if we have it if (!customAssignmentServerSocket.isNull()) { nodeList->setAssignmentServerSocket(customAssignmentServerSocket); } // call a timer function every ASSIGNMENT_REQUEST_INTERVAL_MSECS to ask for assignment, if required qDebug() << "Waiting for assignment -" << _requestAssignment << "\n"; QTimer* timer = new QTimer(this); connect(timer, SIGNAL(timeout()), SLOT(sendAssignmentRequest())); timer->start(ASSIGNMENT_REQUEST_INTERVAL_MSECS); // connect our readPendingDatagrams method to the readyRead() signal of the socket connect(&nodeList->getNodeSocket(), SIGNAL(readyRead()), this, SLOT(readPendingDatagrams())); }
void AudioReciever::Stop(void) { audio_output->stop(); delete audio_output; socket.close(); disconnect(&socket, SIGNAL(readyRead()), this, SLOT(readPendingDatagrams())); }
void SSLReceiver::Start() { if(_isStarted) return; if(!socketIsIntialized) udpsocketSetup(ip,port); connect(udpsocket, SIGNAL(readyRead()), this, SLOT(readPendingDatagrams())); _isStarted=true; }
void MainWindow::createUdpSocket() { groupAdress = QHostAddress("230.0.0.1"); udpSocket = new QUdpSocket(this); if(!udpSocket->bind(5880, QUdpSocket::ShareAddress)) { qDebug("Bind failed!"); } QList<QNetworkInterface> if_list = QNetworkInterface::allInterfaces(); for(int i = 0 ; i < if_list.size(); ++i) { QNetworkInterface this_iface = if_list.at(i); QNetworkInterface::InterfaceFlags if_flags = this_iface.flags(); // skip internal and down ifaces if(if_flags & QNetworkInterface::IsPointToPoint || ! this_iface.CanMulticast) continue; qDebug() << "Join Multicast Group: " << this_iface.humanReadableName(); if(!udpSocket->joinMulticastGroup(groupAdress, this_iface)) { qDebug() << "Join Multicast Group failed! " << this_iface.humanReadableName() << " " << udpSocket->errorString(); } } connect(udpSocket, SIGNAL(readyRead()), this, SLOT(readPendingDatagrams())); }
UdpServer::UdpServer(QObject *parent) : QObject(parent) { mUdpSocket = new QUdpSocket(this); mSerialPort = new SerialPort(this); mTimer = new QTimer(this); mTimer->setInterval(10); mTimer->start(); mPortPath = "/dev/ttyO2"; mUdpPort = 27800; mBaudrate = 115200; mSendArray.clear(); mPayloadLength = 0; mRxDataPtr = 0; mCrcLow = 0; mCrcHigh = 0; connect(mUdpSocket, SIGNAL(readyRead()), this, SLOT(readPendingDatagrams())); connect(mSerialPort, SIGNAL(serial_port_error(int)), this, SLOT(serialPortError(int))); connect(mSerialPort, SIGNAL(serial_data_available()), this, SLOT(serialDataAvilable())); connect(mTimer, SIGNAL(timeout()), this, SLOT(timerSlot())); }
/* *connectOther *负载均衡器打开的时候调用,用来连接UDP端口,打开收发数据端口 */ void UdpSockets::connectOther(int port) { if(m_socket->state() == QAbstractSocket::UnconnectedState) m_socket->bind(port, QUdpSocket::ShareAddress | QUdpSocket::ReuseAddressHint);//端口绑定 connect(m_socket, SIGNAL(readyRead()), this, SLOT(readPendingDatagrams()));//readyRead()信号是每当有新的数据来临时就被触发 }
bool UdpSocketHandler::listen(const QHostAddress &address, quint16 port) { d->socket = new QUdpSocket(this); connect(d->socket, SIGNAL(readyRead()), SLOT(readPendingDatagrams())); connect(d->socket, SIGNAL(stateChanged(QAbstractSocket::SocketState)), SLOT(stateChanged(QAbstractSocket::SocketState))); return d->socket->bind(address, port); }
Receiver::Receiver(int local_port) { udpSocket = new QUdpSocket(this); udpSocket->bind(QHostAddress::LocalHost, local_port); #ifdef Q_WS_WIN int v=4096; if(::setsockopt(udpSocket->socketDescriptor(),SOL_SOCKET,SO_RCVBUF,(char*)&v,sizeof(v))==-1) { qDebug()<<"Data::setConnection: error using setsockopt"; } #endif connect(udpSocket, SIGNAL(readyRead()), this, SLOT(readPendingDatagrams())); client_address=QHostAddress(); iq_port=-1; bandscope_port=-1; rx_sequence=0; tx_sequence=0; tx_offset=0; frequency_changed=0; play_audio=0; client=NULL; client_type=QString("Disconnected"); dspServer=NULL; }
Server::Server( QObject *parent) { // bind(QHostAddress::LocalHost, 7755); connect(this,SIGNAL(readyRead()),this, SLOT(readPendingDatagrams())); }
void SSLReceiver::Stop() { if(!_isStarted) return; disconnect(udpsocket, SIGNAL(readyRead()), this, SLOT(readPendingDatagrams())); delete udpsocket; socketIsIntialized = false; _isStarted=false; }
void Dialog::initSocket() { udpSocket = new QUdpSocket(this); udpSocket->bind(QHostAddress::LocalHost, 1234);//reveive connect(udpSocket, SIGNAL(readyRead()), this, SLOT(readPendingDatagrams())); }
//! [0] void Server::initSocket() { udpSocket = new QUdpSocket(this); udpSocket->bind(QHostAddress::LocalHost, 7755); connect(udpSocket, SIGNAL(readyRead()), this, SLOT(readPendingDatagrams())); }
RemoteController::RemoteController(QWidget *parent): QDialog(parent) { setWindowTitle("Remote controller: port # 6000"); myLostBalls = 3; isStarted = 0; isGameOver = 0; myLeftBtn = new QPushButton("left", this); myRightBtn = new QPushButton("right", this); myStartBtn = new QPushButton("start", this); myLostBallsLbl = new QLabel(QString::number(myLostBalls), this); myBallsLbl = new QLabel("Remained balls = ", this); mySetBtn = new QPushButton("set", this); myInfoLbl = new QLabel("Input ip and port of arcanoid app:", this); myLeftBtn->setEnabled(false); myRightBtn->setEnabled(false); myStartBtn->setEnabled(false); mySetBtn->setEnabled(true); mySocket = new QUdpSocket(this); myIpToEdt = new QLineEdit(this); myIpToLbl = new QLabel("IP = ", this); myPortToEdt = new QLineEdit(this); myPortToLbl = new QLabel("Port = ", this); setLayout(new QVBoxLayout(this)); layout()->addWidget(myInfoLbl); QHBoxLayout *lay = new QHBoxLayout(); lay->addWidget(myIpToLbl); lay->addWidget(myIpToEdt); lay->addWidget(myPortToLbl); lay->addWidget(myPortToEdt); layout()->addItem(lay); layout()->addWidget(mySetBtn); lay = new QHBoxLayout(); lay->addWidget(myBallsLbl); lay->addWidget(myLostBallsLbl); layout()->addItem(lay); lay = new QHBoxLayout(); lay->addWidget(myLeftBtn); lay->addWidget(myRightBtn); lay->addWidget(myStartBtn); layout()->addItem(lay); QObject::connect(myLeftBtn, SIGNAL(pressed()), this, SLOT(left())); QObject::connect(myRightBtn, SIGNAL(pressed()), this, SLOT(right())); QObject::connect(myStartBtn, SIGNAL(pressed()), this, SLOT(start())); QObject::connect(mySetBtn, SIGNAL(pressed()), this, SLOT(set())); QObject::connect(mySocket, SIGNAL(readyRead()), this, SLOT(readPendingDatagrams())); }
CRemoteConsole :: CRemoteConsole( ) { CONSOLE_Print( "[RCON] Remote Console 1.5 loading" ); m_UDPSocket = new QUdpSocket(this); connect(m_UDPSocket, SIGNAL(readyRead()), this, SLOT(readPendingDatagrams())); // lookup "localhost" for later use //bool lookup_success = (inet_aton("localhost", &localhost) == 1); }
UDPInterface::UDPInterface(QObject *parent) : QObject(parent){ eventBuffer = new RingBuffer<Event>(8192); mileStone = 0; socket = new QUdpSocket(this); socket->bind(QHostAddress::LocalHost, 8991); connect(socket, SIGNAL(readyRead()),this, SLOT(readPendingDatagrams())); }
void CommModule::start() { stop(); receiver = new QUdpSocket(); sender = new QUdpSocket(); receiver->bind(QHostAddress::LocalHost,nPortIn); connect(receiver,SIGNAL(readyRead()),this,SLOT(readPendingDatagrams())); }
Connection::Connection(quint16 port, const QHostAddress& serverAdr, quint16 serverP) : serverAddress(serverAdr), serverPort(serverP), socket(this) { socket.bind(port); std::cout << "Server is : " << serverAddress.toString().toUtf8().constData() << " port : " << serverP << std::endl; connect(&socket, SIGNAL(readyRead()), this, SLOT(readPendingDatagrams())); }
MusicFileReceiveServer::MusicFileReceiveServer(QObject *parent) : QObject(parent) { m_receiveSocket = new QUdpSocket(this); m_receiveSocket->bind(QHostAddress::Any, RECEVIE_PORT); connect(m_receiveSocket, SIGNAL(readyRead()), this, SLOT(readPendingDatagrams())); m_file = new QFile(this); }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) { setupUi(this); this->Login->setText("Your nickname"); this->sendS = new QUdpSocket(this); this->sendS->bind(QHostAddress::Any, 3333, QUdpSocket::ReuseAddressHint); connect(this->sendS, SIGNAL(readyRead()), this, SLOT(readPendingDatagrams())); }
void sACNListener::startReception() { qDebug() << "sACNListener" << QThread::currentThreadId() << ": Starting universe" << m_universe; // Clear the levels array memset(&m_last_levels, -1, 512); // Listen multicast m_sockets.push_back(new sACNRxSocket()); if (m_sockets.back()->bindMulticast(m_universe)) { connect(m_sockets.back(), SIGNAL(readyRead()), this, SLOT(readPendingDatagrams()), Qt::DirectConnection); } else { // Failed to bind, m_sockets.pop_back(); } // Listen unicast m_sockets.push_back(new sACNRxSocket()); if (m_sockets.back()->bindUnicast()) { connect(m_sockets.back(), SIGNAL(readyRead()), this, SLOT(readPendingDatagrams()), Qt::DirectConnection); } else { // Failed to bind m_sockets.pop_back(); } // Start intial sampling m_initalSampleTimer = new QTimer(this); m_initalSampleTimer->setSingleShot(true); m_initalSampleTimer->setInterval(SAMPLE_TIME); connect(m_initalSampleTimer, SIGNAL(timeout()), this, SLOT(sampleExpiration()), Qt::DirectConnection); m_initalSampleTimer->start(); // Merge is performed whenever the thread has time m_elapsedTime.start(); m_mergesPerSecondTimer.start(); m_mergeTimer = new QTimer(this); m_mergeTimer->setInterval(1); connect(m_mergeTimer, SIGNAL(timeout()), this, SLOT(performMerge()), Qt::DirectConnection); connect(m_mergeTimer, SIGNAL(timeout()), this, SLOT(checkSourceExpiration()), Qt::DirectConnection); m_mergeTimer->start(); }
void InputManager::init(QSettings *setting) { settinglink = setting; socket = new QUdpSocket(this); socket->bind( settinglink->value("system/net/port").toInt() ); emit debugOutput(tr("bound to UDP port:") + settinglink->value("system/net/port").toString() ); connect( socket, SIGNAL(readyRead()), this, SLOT(readPendingDatagrams()) ); emit debugOutput(tr("inputmanager initialized")); }
void Server::initSocket() { m_udpSocket = new QUdpSocket(this); connect(m_udpSocket, SIGNAL(readyRead()), this, SLOT(readPendingDatagrams())); if (m_udpSocket->bind(QHostAddress::AnyIPv4, 53000)) { qDebug() << "Bind: OK" << endl; } }
void MvbThread::Start() { bool bind = socket->bind(QHostAddress::Any, 41000); if(bind){ connect(socket, SIGNAL(readyRead()), this, SLOT(readPendingDatagrams())); connect(this, SIGNAL(StartPlayVideo(QString,QString)), MainWindow::getInstance()->vd, SLOT(Play(QString,QString))); connect(this, SIGNAL(StopPlayVideo()), MainWindow::getInstance()->vd, SLOT(Stop())); isPlayVideo = 0; }else{ qDebug() << "Not BIND"; } }
bool AudioReciever::Start(void) { qDebug()<< "Ресивер старт"; audio_output = new QAudioOutput(GetStreamAudioFormat()); audio_output->setVolume(1.0); audio_device = audio_output->start(); connect(&socket, SIGNAL(readyRead()), this, SLOT(readPendingDatagrams())); return socket.bind(QHostAddress::Any, 45001,QUdpSocket::ShareAddress | QUdpSocket::ReuseAddressHint); }
UBProxy::UBProxy(QObject *parent) : QObject(parent) { m_server = new UBServer(this); m_server->startServer(PHY_PORT); connect(m_server, SIGNAL(dataReady(QByteArray)), this, SLOT(netDataReadyEvent(QByteArray))); m_socket = new QUdpSocket(this); m_socket->bind(QHostAddress::AnyIPv4, PXY_PORT, QUdpSocket::ShareAddress); // m_socket->joinMulticastGroup(QHostAddress(tr("192.168.1.255"))); connect(m_socket, SIGNAL(readyRead()), this, SLOT(readPendingDatagrams())); }
DdeFaceTracker::DdeFaceTracker(const QHostAddress& host, quint16 serverPort, quint16 controlPort) : _ddeProcess(NULL), _ddeStopping(false), _host(host), _serverPort(serverPort), _controlPort(controlPort), _lastReceiveTimestamp(0), _reset(false), _leftBlinkIndex(0), // see http://support.faceshift.com/support/articles/35129-export-of-blendshapes _rightBlinkIndex(1), _leftEyeOpenIndex(8), _rightEyeOpenIndex(9), _browDownLeftIndex(14), _browDownRightIndex(15), _browUpCenterIndex(16), _browUpLeftIndex(17), _browUpRightIndex(18), _mouthSmileLeftIndex(28), _mouthSmileRightIndex(29), _jawOpenIndex(21), _lastMessageReceived(0), _averageMessageTime(STARTING_DDE_MESSAGE_TIME), _lastHeadTranslation(glm::vec3(0.0f)), _filteredHeadTranslation(glm::vec3(0.0f)), _lastBrowUp(0.0f), _filteredBrowUp(0.0f), _lastEyeBlinks(), _filteredEyeBlinks(), _lastEyeCoefficients(), _eyeClosingThreshold("ddeEyeClosingThreshold", DEFAULT_DDE_EYE_CLOSING_THRESHOLD), _isCalibrating(false), _calibrationCount(0), _calibrationValues(), _calibrationBillboard(NULL), _calibrationBillboardID(0), _calibrationMessage(QString()), _isCalibrated(false) { _coefficients.resize(NUM_FACESHIFT_BLENDSHAPES); _blendshapeCoefficients.resize(NUM_FACESHIFT_BLENDSHAPES); _coefficientAverages.resize(NUM_FACESHIFT_BLENDSHAPES); _calibrationValues.resize(NUM_FACESHIFT_BLENDSHAPES); _eyeStates[0] = EYE_UNCONTROLLED; _eyeStates[1] = EYE_UNCONTROLLED; connect(&_udpSocket, SIGNAL(readyRead()), SLOT(readPendingDatagrams())); connect(&_udpSocket, SIGNAL(error(QAbstractSocket::SocketError)), SLOT(socketErrorOccurred(QAbstractSocket::SocketError))); connect(&_udpSocket, SIGNAL(stateChanged(QAbstractSocket::SocketState)), SLOT(socketStateChanged(QAbstractSocket::SocketState))); }