PDA

View Full Version : How to determine ip address of remote host?



nopalot
30th April 2006, 20:33
Hi Folks,

is there a way to determine the ip address of a remote host by the socket descriptor passed to QTcpServer::incomingConnection()?
I would like to accept only connections from trusted ip addresses.
Please let me know if you have any ideas how this can be done.
Thanks in advance,
nop nop nop....

jacek
30th April 2006, 21:18
If you have QTcpSocket you can use the peerAddress() method. With a descriptor you might try POSIX getpeername() function.