DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
Developing applications using XTI or TLI

Error conditions

Most of the XTI functions return a value of -1 if they encounter an error. In that case the global variable t_errno is set to one of errors defined for the function. These errors are all defined in the header file xti.h. The manual page for each function also lists the errors that the function can return.

One of the special errors defined is TLOOK. When a function returns this ``error'', an asynchronous event has occurred that the process should investigate and respond to. An asynchronous event occurs when the transport provider has detected something that is unrelated to what the process is doing at the moment. The process can determine what event has occurred by calling the t_look function. This function returns one of the events listed at the end of this section.

For example, assume a process attempts to read data over an established connection with the t_rcv call. Normally, this call returns with data sent by a remote process. However, instead of data, the transport provider may have received a signal from the remote process to disconnect. In this case, the t_rcv call returns with a value of -1. The process should now examine the variable t_errno, which contains the value TLOOK. The process can then call the function t_look, which returns the name of the event that occurred, namely T_DISCONNECT. At this point, the process can perform actions appropriate to this event (such as calling t_rcvdis to acknowledge the disconnect request).

One other error to note is TSYSERR. This means that a UNIX system error has occurred. In this case, the process should examine the global variable errno for the precise error.

The events defined in XTI are:


T_LISTEN
The transport provider at the server has received a request from a client to connect.

T_CONNECT
The transport provider at the client has received a confirmation from the server that a connection has been established.

T_DATA
The transport provider has received data.

T_EXDATA
The transport provider has received expedited data.

T_DISCONNECT
The transport provider has received a request to disconnect.

T_UDERR
The transport provider has received an indication that there was an error associated with the most recently sent datagram.

T_ORDREL
The transport provider has received a request to disconnect with orderly release.

T_GODATA
Flow control has been lifted, and the process can now send data through the transport endpoint.

T_GOEXDATA
Flow control has been lifted, and the process can now send expedited data through the transport endpoint.

Next topic: Options management
Previous topic: Transport provider states

© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003