jefklak
22nd October 2010, 20:43
Hey,
I want to use Qt to set up a connection over LAN using UDP. I do this using following code:
sock = new QUdpSocket(this);
sock->bind(QHostAddress("192.168.1.5"), 9998);
connect(sock, SIGNAL(readyRead()), this, SLOT(processMessage()));
This way I have to enter my IP-address manually, which isn't nice off course. How can I get the correct IP-address dynamically?
I am using Qt 4.7.0 in Windows.
I want to use Qt to set up a connection over LAN using UDP. I do this using following code:
sock = new QUdpSocket(this);
sock->bind(QHostAddress("192.168.1.5"), 9998);
connect(sock, SIGNAL(readyRead()), this, SLOT(processMessage()));
This way I have to enter my IP-address manually, which isn't nice off course. How can I get the correct IP-address dynamically?
I am using Qt 4.7.0 in Windows.