#include "spx_app.h"int t_sndrel ( int spxFd )
spxFd
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.
{ 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); }
If an orderly release indication has not been received, the state will change from T_DATAXFER to T_OUTREL after t_sndrel is called.