t_rcvrel(3xti_spx)


t_rcvrel -- acknowledge receipt of an orderly release indication

Synopsis

#include "spx_app.h" 

int t_rcvrel ( int spxFd )

Parameters

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

Return values

0
Successful

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

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

TNOREL
No orderly release indication currently exists.

TLOOK
An asychronous event has occurred on the transport endpoint referenced by spxFd and requires immediate attention.

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.

Remarks

The t_rcvrel function is used to acknowledge receipt of an orderly release indication. After receipt of this indication, the user should not attempt to receive more data because such an attempt will block forever.

This call works as specified in ``Programming with the X/Open Transport Interface (XTI)''.

Because the other endpoint might send a T_DISCONNECT, a user should not loop waiting only for an orderly release indication.

If a loop is desirable, t_look should be used to detect T_INREL or T_DISCONNECT.

If a t_sndrel call has not been issued by the user, the user can continue to send data over the connection.

If the connection is not an SPXII connection, TNOREL is returned.

The correct procedure to orderly terminate 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; 
      ... 
   

/* ** Receive data loop */ while ((rcvbytes = t_rcv(spxFd,dataBuf,sizeof(dataBuf),&flags))!= -1 ) { fprintf(stderr,"received %d bytes Do something with them\n",rcvbytes); }

/* t_rcv failed. Find out why */ if (t_errno == T_LOOK) { lookVal = t_look(spxFd); switch (lookVal) { case T_ORDREL: /* ** If Orderly Release, receive it and continue */ if(t_rcvrel(spxFd) < 0) { t_error( "t_rcvrel failed"); exit(-1); } break; case T_DISCONNECT: /* ** If disconnect, exit now */ if(t_rcvdis(spxFd) < 0) { t_error( "t_rcvrel failed"); exit(-1); } exit(); default: fprintf(stderr,"t_look return %d in receive loop\n",lookVal); exit(); } } else { t_error("t_rcv failed "); exit(-1); } /* ** Send more data; then send Orderly Release request */ ...

t_close(spxFd); }

State

If an orderly release request has been sent, the state will change from T_OUTREL to T_IDLE.

If an orderly release request has not been sent, the state will change from T_DATAXFER to T_INREL.

References

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