t_sndrel(3xti_spx)


t_sndrel -- request an orderly release of an SPXII connection

Synopsis

#include "spx_app.h" 

int t_sndrel ( int spxFd )

Parameters

(IN) spxFd
Passes the file descriptor of the local transport endpoint.

Return values

0
Successful

-1
Unsuccessful
If t_sndrel returns an error, t_errno may be set to one of the following:

TBADF
The specified file descriptor does not refer to a transport endpoint.

TFLOW
O_NDELAY or O_NONBLOCK was set, but flow control prevented SPXII from accepting the function at this time.

TSYSERR
A system error has occurred during execution of this function; check errno for possible further information.

TNOTSUPPORTED
This function is not supported by the underlying transport provider.


NOTE: If t_sndrel is issued from an invalid state or if the connection is not an SPXII connection, SPXII will generate a fatal EPROTO error. However, this error may not occur until a subsequent reference to SPXII.

Remarks

The t_sndrel function is used to initiate an orderly release of a transport connection and indicates to the transport provider (SPXII) that the transport user (application) has no more data to send.


NOTE: This function is supported only when both endpoints are using SPXII.

This function works as specified in ``Programming with the X/Open Transport Interface (XTI)''. A t_sndrel call sends a orderly release request, indicating to both endpoints that the user sending the orderly release will not send any more data. However, a user may continue to receive data if an orderly release indication has not been received.

Even if the service type T_COTS_ORD is returned on t_open or t_getinfo, t_sndrel may return EPROTO if the connection is not an SPXII connection. The spxIISessionFlags returned in the opt structure from the t_listen or the t_connect function calls can be examined to determine whether the connection is SPXII.

The correct procedure for an orderly termination of an SPXII connection is for both endpoints to send an orderly release request when there is no more data to send. Then both continue to read data until an orderly release indication is received. At this point, both endpoints are finished sending and receiving data, and the connection state is set to T_IDLE.

Examples

   { 
      int spxFd; 
      ... 
   

/* All done sending data. Send orderly release. */ if(t_sndrel(spxFd) < 0) { t_error( "t_sndrel failed" ); exit(-1); } /* ** Receive more data and wait for orderly release indication. */ ...

t_close(spxFd); }

State

If an orderly release indication has been received, the state will change from T_INREL to T_IDLE after t_sndrel is called.

If an orderly release indication has not been received, the state will change from T_DATAXFER to T_OUTREL after t_sndrel is called.

References

t_rcvrel(3xti_spx), t_sndrel(3xti)
30 January 1998
© 1998 The Santa Cruz Operation, Inc. All rights reserved.