void DuktoProtocol::initialize() { mSocket = new QUdpSocket(this); mSocket->bind(QHostAddress::Any, mLocalUdpPort); connect(mSocket, SIGNAL(readyRead()), this, SLOT(newUdpData())); mTcpServer = new QTcpServer(this); mTcpServer->listen(QHostAddress::Any, mLocalTcpPort); connect(mTcpServer, SIGNAL(newConnection()), this, SLOT(newIncomingConnection())); }
DuktoProtocol::DuktoProtocol() : mSocket(NULL), mTcpServer(NULL), mCurrentSocket(NULL), mCurrentFile(NULL), mFilesToSend(NULL) { mSocket = new QUdpSocket(this); mSocket->bind(QHostAddress::Any, UDP_PORT); connect(mSocket, SIGNAL(readyRead()), this, SLOT(newUdpData())); mTcpServer = new QTcpServer(this); mTcpServer->listen(QHostAddress::Any, TCP_PORT); connect(mTcpServer, SIGNAL(newConnection()), this, SLOT(newIncomingConnection())); mIsSending = false; mIsReceiving = false; }