XTI and sockets
The socket interface, made popular by the Berkeley version of
UNIX, is another API that programs can use to
access transport providers.
A socket closely resembles an XTI transport endpoint.
In general, both XTI and the
sockets library provide similar functionality.
The list below calls out some of the differences between
XTI and sockets. This
information may be useful to those who are already familiar with
socket programming or who have programs they wish
to port from sockets to XTI.
Note that a sockets library is available
for use on SCO systems with the
TCP and UDP protocols.
-
XTI defines the t_alloc function for allocating data
structures needed by some of the other XTI functions.
The data structures allocated are very generic to support a variety of
transport providers.
There is no analogous socket function.
-
A process specifies the protocol associated with a socket by passing
in an integer argument (for example, AF_INET)
to the socket call.
A process specifies the protocol associated
with a transport endpoint by passing
to the t_open function a string specifying the
pathname of the device node associated with the protocol
(for example, /dev/tcp).
-
A client that makes a connection to a server using XTI
calls t_bind before calling t_connect.
However, a client that makes a connection to a server using sockets
does not call bind before calling connect.
-
A server preparing to receive incoming connection requests using
XTI in synchronous mode first calls t_bind
to establish the length of the incoming request queue, then calls
t_listen and blocks.
Using sockets, a server calls
listen to
establish the length of the incoming request queue, then calls
accept and blocks.
-
Using XTI, a server can reject a connection request by
calling t_snddis after returning from t_listen.
Using sockets, a server always accepts an incoming
connection request when it returns from accept.
It must then close the socket to,
in effect, reject the connection.
-
The socket system call (which creates a socket) permits a
number of parameters to be set that have no analog in the
t_open function call (which creates a transport endpoint).
In particular, the functionality of calling socket with
the SOCK_RAW parameter has no analog in XTI.
-
Using XTI, it is not possible to ``peek'' at an incoming
message (look at it without consuming it).
-
Using XTI, it is not possible to perform scatter reads or
gather writes.
The above list is not exhaustive. Compare the manual pages
for both the sockets library (SSC and SLIB)
and XTI for more detailed information.
Next topic:
Transport-specific issues
Previous topic:
XTI and TLI
© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003