Forum > Networking and Web Programming

[SOLVED] gethostbyname(gethostname, host) returns random host.addr on MacOs

<< < (2/2)

Key-Real:
In which unit is getifaddrs() ?

Key-Real:
I wrote custom bindings for getifaddrs(ifap).
It works because I get the ifap^.ifa_name right!

how to get the ip address string out of ifap^.ifa_addr^ ???

Remy Lebeau:

--- Quote from: Key-Real on November 21, 2023, 05:08:54 pm ---how to get the ip address string out of ifap^.ifa_addr^ ???

--- End quote ---

You can use getnameinfo() or inet_ntop().

Key-Real:
in which unit is getnameinfo.

for inet_ntop the unit network.pp is not availible on mac

Key-Real:
I found a solution:

https://forum.lazarus.freepascal.org/index.php?topic=65309.msg497550#msg497550

Navigation

[0] Message Index

[*] Previous page

Go to full version