PDA

View Full Version : Ip adress search



Mayssa
16th December 2011, 11:18
Hello,

I need to search an Ip address of a devise in order to communicate with later. So I will send a broadcast message through a specific port number and when I receive a response , I will detect the Source address of that response. How could I detect the Ip adress of the sender ( the devise which respond to the broadcast message) ?
with a winsock library of windows , the function "recvfrom" contains already informations about the sender; but I don't know how it is managed in QT.

thank you for help

Spitfire
16th December 2011, 13:40
I guess QUdpSocket (http://doc.qt.nokia.com/4.3/qudpsocket.html)is what you're looking for then you can get the sender's ip using readDatagram() (http://doc.qt.nokia.com/4.3/qudpsocket.html#readDatagram).

Mayssa
16th December 2011, 14:03
oh thank you; this is what I am looking for :)