[fpc-devel] StrToHostAddr

Mattias Gaertner nc-gaertnma at netcologne.de
Sat Nov 5 18:01:21 CET 2011


Hi all,

The function StrToHostAddr in unit sockets returns for '127.0.0.1' on a
little endian system the in_addr:
s_bytes[1]=1
s_bytes[2]=0
s_bytes[3]=0
s_bytes[4]=127

Is this correct?

The documentation for HostAddrToStr writes "Basically, it is the same
as NetAddrToStr, but with the bytes in correct order.":
http://lazarus-ccr.sourceforge.net/docs/rtl/sockets/hostaddrtostr.html
This sounds as if a Net and a Host uses different ordered bytes, which
makes the whole point of an "and" mask pointless.


Mattias



More information about the fpc-devel mailing list