A TCP/IP program uses a socket address encapsulated in a
TInetAddr
object. This is the expected form for passing address
information when using RSocket
and RHostResolver
for
TCP/IP. A TInetAddr
object stores the IP address and port of a
socket.
A program may have to handle IP addresses represented in other formats as well:
as a dotted-decimal string (for example, ‘194.129.2.54’)
stored in a descriptor, such as might be entered by a user in a dialog.
TInetAddr
offers functions to convert such a representation back
and forth.
as a unsigned 32-bit integer: this is the usual binary
representation of an IP address. This can be used to initialise a
TInetAddr
through the relevant constructor.
as 4 integers forming a dotted-decimal address: the macro
INET_ADDR
is used to convert this into integer format in the
appropriate byte-order.
All addresses are handled in the native byte order, so you do not
need to use byte-order conversion functions, such as BSD’s
htonl()
or htons()
.