xopen_networking(7)xopen_networking(7)NAMExopen_networking - X/Open Networking Interfaces
X/Open has defined and interfaces in and
X/Open has also defined XTI in and Beginning in UNIX 03, XTI is no
longer part of
For more information on the specifications or a detailed description of
the X/Open Networking Interfaces, please refer to the above specifica‐
tions at website,
Prior to HP-UX 11i v3, HP-UX is certified to UNIX 95 on PA-RISC and
Integrity systems. Beginning with HP-UX 11i v3, HP-UX is certified to
UNIX 95 on PA-RISC systems and to UNIX 95 and UNIX 03 on Integrity sys‐
There are two ways to obtain X/Open Sockets functionality:
Method A is in compliance with X/Open compilation specification.
Method B slightly deviates from X/Open compilation specifica‐
tion. However, Method B allows a program to include both
objects compiled to X/Open Sockets specification and objects
compiled to BSD Sockets specification.
Either or utilities can be used. Refer to cc(1) for details. Also note
certain features in are only available if is used. For example, the
"restrict" qualifier for pointers is only available if c99 is used.
Method A) Strict Compliance Method
An X/Open conforming application is one that has all its parts compiled
and built according to X/Open specifications. For such conforming
applications, this compilation method would be appropriate. Applica‐
tions should ensure that the feature test macro is defined with the
value To ensure portability, applications should define the macro
either on the compilation command line, or at the beginning of each
source module prior to the inclusion of any headers.
For example, to compile a 64 bit object using
Applications should ensure that the feature test macros and are
defined. To ensure portability, applications should define the
macros either on the compilation command line, or at the begin‐
ning of each source module prior to the inclusion of any head‐
For example, to compile a 64 bit object using
Link the program objects with library.
Note if the library is also specified in the link line, the library has
to be specified before the library. Otherwise, X/Open Sockets calls
would have been resolved to BSD Sockets functions in the library
instead of X/Open Sockets functions in the library.
Method B) Alternative Method
HP-UX provides two styles of Sockets API:
· default BSD Sockets
· X/Open Sockets
These two styles of Sockets API have the same function names but they
have differences in semantics and argument types. For example, the
optlen field in X/Open is type, while BSD is type. In 64 bit mode, is
64 bit and is still 32 bit.
Linking objects compiled to X/Open Sockets specification and objects
compiled to BSD Sockets specification in the same program using the
linkage method in method A would erroneously resolve BSD Sockets calls
to X/Open Sockets functions in the library. As a result, the program
may result in application core dumps or unexpected Socket errors when
it is run. These symptoms commonly occur when BSD Sockets and are
For such mixed program configuration, the compilation and linkage meth‐
ods described below in should be used. Define in addition to either
defining in or and in
For example to compile a 64-bit X/Open Sockets object and a 64-bit BSD
Sockets object using
With this method, X/Open Sockets calls are remapped by the static Sock‐
ets functions in <sys/socket.h> to an alternative set of X/Open Sockets
functions in library. This alternative set has a prefix in its func‐
tion names, for example,
Because the alternative set has different function names, X/Open Sock‐
ets calls are not confused with BSD Sockets calls at link time.
Other than the naming difference, this alternative set is identical to
the X/Open Sockets functions in library. Other than adding an addi‐
tional macro, this compilation method is compliant to X/Open specifica‐
tions. Link with library instead of library. library should not be
included in the application link line.
Because library is not in the link line, BSD Sockets calls are not
erroneously resolved to X/Open Sockets functions in library.
Method B might become the default method in a future release. At that
time, would be defined by default.
X/Open and interfaces were developed by HP and X/Open Company Limited.
SEE ALSOt_accept(3), t_alloc(3), t_bind(3), t_close(3), t_connect(3),
t_error(3), t_free(3), t_getinfo(3), t_getprotaddr(3), t_getstate(3),
t_listen(3), t_look(3), t_open(3), t_optmgmt(3), t_rcv(3), t_rcvcon‐
nect(3), t_rcvdis(3), t_rcvrel(3), t_rcvudata(3), t_rcvuderr(3),
t_snd(3), t_snddis(3), t_sndrel(3), t_sndudata(3), t_strerror(3),
accept(2), bind(2), close(2), connect(2), fcntl(2), fgetpos(3S), fset‐
pos(3S), ftell(3S), getpeername(2), getsockname(2), getsockopt(2), lis‐
ten(2), lseek(2), poll(2), read(1), recv(2), recvfrom(2), recvmsg(2),
select(2), send(2), sendmsg(2), sendto(2), setsockopt(2), shutdown(2),
sockatmark(3N), socket(2), socketpair(2), write(1).
gethostname(2), endhostent(3N), endnetent(3N), endprotoent(3N), endser‐
vent(3N), freeaddrinfo(3N), gai_strerror(3N), getaddrinfo(3N), gethost‐
byaddr(3N), getnameinfo(3N), getnetbyaddr(3N), getprotobynumber(3N),
getservbyport(3N), htonl(3N), if_freenameindex(3N), if_indextoname(3N),
if_nameindex(3N), if_nametoindex(3N), inet_addr(3N), ntohl(3N), sethos‐
tent(3N), setnetent(3N), setprotoent(3N), setservent(3N).