Programming with sockets

Sockets migration and sockets-to-XTI conversion

This section provides an introduction to the issues involved in porting a sockets application to XTI and includes notes on the differences between BSD sockets and Release 6.0.0 sockets that programmers must be aware of. Although existing sockets applications can be rewritten for XTI relatively easily, such ports are not necessary for sockets applications that are to run only over TCP/IP or UDP/IP networks. However, XTI is the preferred programming interface for accessing transport services and it is recommended that programmers writing new applications for Release 6.0.0 use XTI.

Both XTI and sockets routines are defined in terms of communications paths identified by file descriptors. These file descriptors are known as ``transport endpoints'' for XTI and as ``sockets'' for the socket interface. In most cases, there are parallel routines for each transport function. For example, the XTI routine t_open returns a file descriptor that identifies a transport endpoint; the routine socket returns a file descriptor that identifies a socket. ``Table of XTI/Sockets equivalents'' shows the parallels among XTI and sockets interface routines.

This section will highlight the areas in which there is no direct correspondence between XTI and sockets routines. The examples will first show code that uses the socket interface and then show how to rewrite the program using XTI.

``Moving sockets applications to Release 6.0.0'' documents differences between Release 6.0.0 sockets and BSD sockets. Programmers must be aware of these differences before moving BSD sockets applications to Release 6.0.0.

Release 6.0.0 socket calls are implemented as library routines. Application programs that use sockets should be compiled and linked with socket libraries:

cc prog.c -dy -lsocket -lnsl

© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 -- 02 June 2005