What is UNIX

Networking Services Migration

A White Paper from the X/Open XNET Working Group.

Version 1 Last update July 24 1997.


This white paper gives a brief outline of the changes to the Networking Services in the Single UNIX Specification, Version 2.

This paper is part of a series of brief papers describing new and changed features in the UNIX specification.


This section highlights the major changes in Networking Services, Issue 5 that might affect an application programmer.

Change of size_t to socklen_t

Many of the interfaces using size_t have a new abstract type, socklen_t, introduced as part of the data size neutrality changes in the Single UNIX Specification, Version 2.

This has been introduced due to the widespread use of size_t to represent lengths of various objects in the context of socket interfaces and the move to 64-bit architectures. While size_t, being the largest size abstract buffer length, needs to evolve so that interfaces can use 64 bits to their advantage, most of the objects it is used with do not need to evolve, as such. Thus continued use of size_t would have caused unnecessary evolution of the socket binary interface without any added benefit.

The interfaces affected are as follows:

Introduction of t_scalar_t and t_uscalar_t for XTI

Instances of the types unsigned long and long have been changed to an abstract unsigned integral type, t_uscalar_t, and an abstract signed integral type, t_scalar_t, respectively.

t_scalar_t and t_uscalar_t are equal length and occupy at least 32 bits.

This has been introduced due to the use of type long in 64-bit environments causing a binary incompatibility problem. Since long in 64-bit environments is 64 bit and 32 bit in 32-bit environments, if the specification had remained as is, XTI providers would have had to provide two sets of XTI libraries and expensive conversion modules to convert structures of one form to another. XTI performance would have consequently suffered significant degradation.

This change is pervasive in Networking Services, Issue 5 XTI.

It also explicitly affects the following interfaces:

t_getinfo(), t_open(), t_optmgmt(), t_optmgmt(), <xti.h>

Introduction of uint16_t and uint32_t for Sockets

The instances of the types in_addr_t and in_port_t have been changed to unsigned integral types uint32_t and uint16_t, respectively. The change has been made since the functions htons(), and so on, which make use of the in_addr_t and in_port_t types are, in practice, used with general 32 and 16-bit quantities, not just Internet addresses and port numbers.

The functions affected include:

htonl(), htons(), ntohl(), ntohs()


Networking Services, Issue 5 has been updated to address thread-safety since the Single UNIX Specification, Version 2 includes threads. All interfaces defined by Networking Services, Issue 5 will be thread-safe, except for the following interfaces which need not be thread-safe:

gethostbyaddr(), gethostbyname(), gethostent(), getnetbyaddr(), getnetbyname(), getnetent(), getprotobynumber(), getprotobyname(), getprotoent(), getservbyname(), getservbyport(), getservent(), inet_ntoa()

A portable multi-threaded application may only safely call these functions when access to the function is serialized.

Scatter/Gather Support

The following functions are new in Networking Services, Issue 5, added to support scatter/gather vectored input/output. These routines are analogous to readv() and writev() from the XSH specification.

t_rcvv(), t_rcvvudata(), t_sndv(), t_sndvudata()

Networking Services Mailing List

The Open Group hosts an open mailing list to discuss Networking Services, to join the list send a request to xnet-request (at) opengroup.org

Related technical papers:

Read other technical papers.

Read or download the complete Single UNIX Specification from http://www.UNIX-systems.org/go/unix.

Copyright © 1997-1998 The Open Group

UNIX is a registered trademark of The Open Group.