Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Why QHostAddress().toIPv4Address() is different from inet_addr()?
eyeofhell last edited by
On Windows, QHostAddress().toIPv4Address() returns IP representation that is a reverted representation inet_addr() returns. For example:
@QHostAddress( "192.168.0.1" ).toIPv4Address() != inet_add( "192.168.0.1" )@
Why is such difference? And what is a good way to get "native" IP address representation that i can pass to third-party libraries or API functions?
ZapB last edited by
Probably so as to get the same result an big and little-endian machines. The MS inet_add() function looks to be different for different endianesses (from the docs).
romankr last edited by
read docks :)
winsock takes in account different byte order of different network interfaces.