Thixomag
22nd February 2009, 19:52
Hello
I’m making an application with an UDP client/server communication.
The client has to open the 3301 port on his router to receive the socket. (and the server has to open the 3300, but that is not importante)
And I would like to know how I could receive the socket on the PC's client without this opening port.
Server Side :
-Listening
m_udpSocket = new QUdpSocket;
m_udpSocket->bind(QHostAddress::Any, 3300, QUdpSocket::ShareAddress);
connect(m_udpSocket, SIGNAL(readyRead()), this, SLOT(get()));
-Sending
QUdpSocket udpSocket;
udpSocket.bind(3301); // I don't know if that is important
udpSocket.writeDatagram(datagram, ip, 3301);
Client Side :
-Listening
m_serverAdress = new QHostAddress("**.**.***.**");
m_udpSocket = new QUdpSocket;
m_udpSocket->bind(QHostAddress::Any, 3301, QUdpSocket::ShareAddress); /// if I put *m_serverAdress instead of QHostAddress::Any, I receive nothing even with the port openning
connect(m_udpSocket, SIGNAL(readyRead()), this, SLOT(get()));
-Sending
m_udpSocket->writeDatagram(datagram, *m_serverAdress, 3300);
Thanks You
I’m making an application with an UDP client/server communication.
The client has to open the 3301 port on his router to receive the socket. (and the server has to open the 3300, but that is not importante)
And I would like to know how I could receive the socket on the PC's client without this opening port.
Server Side :
-Listening
m_udpSocket = new QUdpSocket;
m_udpSocket->bind(QHostAddress::Any, 3300, QUdpSocket::ShareAddress);
connect(m_udpSocket, SIGNAL(readyRead()), this, SLOT(get()));
-Sending
QUdpSocket udpSocket;
udpSocket.bind(3301); // I don't know if that is important
udpSocket.writeDatagram(datagram, ip, 3301);
Client Side :
-Listening
m_serverAdress = new QHostAddress("**.**.***.**");
m_udpSocket = new QUdpSocket;
m_udpSocket->bind(QHostAddress::Any, 3301, QUdpSocket::ShareAddress); /// if I put *m_serverAdress instead of QHostAddress::Any, I receive nothing even with the port openning
connect(m_udpSocket, SIGNAL(readyRead()), this, SLOT(get()));
-Sending
m_udpSocket->writeDatagram(datagram, *m_serverAdress, 3300);
Thanks You