With tirdwr on a stream, you can send and receive data over a transport connection for the duration of the connection. Either user can terminate the connection by closing the file descriptor associated with the transport endpoint or by popping the tirdwr module off the stream. In either case, tirdwr does the following:
If an orderly release request was previously received by tirdwr, it is passed to the transport provider to complete the orderly release of the connection. The remote user who initiated the orderly release procedure receives the expected request when data transfer completes.
If a disconnect request was previously received by tirdwr, no special action is taken.
If neither an orderly release nor a disconnect request was previously received by tirdwr, a disconnect request is passed to the transport provider to abort the connection.
If an error previously occurred on the stream and a disconnect request has not been received by tirdwr, a disconnect request is passed to the transport provider.
A process cannot initiate an orderly release after tirdwr is pushed onto a stream. tirdwr handles an orderly release if it is initiated by the user on the other side of a transport connection. If the client in this section is communicating with the server program in "Connection Mode Service", the server terminates the transfer of data with an orderly release request. The server then waits for the corresponding request from the client. At that point, the client exits and the transport endpoint is closed. When the file descriptor is closed, tirdwr initiates the orderly release request from the client's side of the connection. This generates the request that the server is blocked on.
Some protocols, like TCP, require this orderly release to ensure that the data is delivered intact.