Transport Interfaces Programming Guide

Socket-to-XTI/TLI Equivalents

Table 3-15 shows approximate equivalents between XTI/TLI functions and socket functions. The comment field describes the differences. If there is no comment either the functions are similar or there is no equivalent function in either interface.

Table 3-15 TLI and Socket Equivalent Functions

TLI function 

Socket function 

Comments 

t_open()

socket()

 

-

socketpair()

 

t_bind()

bind()

t_bind() sets the queue depth for passive sockets, but bind() doesn't. For sockets, the queue length is specified in the call to listen().

t_optmgmt()

getsockopt()

setsockopt()

t_optmgmt() manages only transport options. getsockopt() and setsockopt() can manage options at the transport layer, but also at the socket layer and at the arbitrary protocol layer.

t_unbind()

 

-

t_close()

close()

 

t_getinfo()

getsockopt()

t_getinfo() returns information about the transport. getsockopt() can return information about the transport and the socket.

t_getstate()

-

 

t_sync()

-

 

t_alloc()

-

 

t_free()

-

 

t_look()

-

getsockopt() with the SO_ERROR option returns the same kind of error information as t_look().

t_error()

perror()

 

t_connect()

connect()

A connect() can be done without first binding the local endpoint. The endpoint must be bound before calling t_connect(). A connect() can be done on a connectionless endpoint to set the default destination address for datagrams. Data may be sent on a connect().

t_rcvconnect()

-

 

t_listen()

listen()

t_listen() waits for connection indications. listen() merely sets the queue depth.

t_accept()

accept()

 

t_snd()

send()

 

 

sendto()

 

 

sendmsg()

sendto() and sendmsg() operate in connection mode as well as datagram mode.

t_rcv()

recv()

 

 

recvfrom()

 

 

recvmsg()

recvfrom() and recvmsg() operate in connection mode as well as datagram mode.

t_snddis()

-

 

t_rcvdis()

-

 

t_sndrel()

shutdown()

 

t_rcvrel()

-

 

t_sndudata()

sendto()

 

 

recvmsg()

 

t_rcvuderr()

-

 

read(), write()

read(), write()

In XTI/TLI you must push the tirdwr() module before calling read() or write(); in sockets, just call read() or write().