ONC+ RPC Developer's Guide

Exit Print View

Updated: July 2014
 
 

Client Connection Closure Callback

Client connection closure callback enables the server for connection-oriented transport to detect that the client has disconnected. The server can take the necessary action to recover from transport errors. Transport errors occur when a request arrives at the server, or when the server is waiting for a request and the connection is closed.

The connection closure callback is called when no requests are currently being executed on the connection. If the client connection is closed when a request is being executed, the server executes the request but a reply may not be sent to the client. The connection closure callback is called when all pending request are completed.

When a connection closure occurs, the transport layer sends an error message to the client. The handler is attached to a service using svc_control() for example as follows:

svc_control(service, SVCSET_RECVERRHANDLER, handler);

The arguments of svc_control() are:

  1. A service or an instance of this service. When this argument is a service, any new connection to the service inherits the error handler. When this argument is an instance of the service, only this connection gets the error handler.

  2. The error handler callback. The prototype of this callback function is:

    void handler(const SVCXPRT *svc, const boot_t IsAConnection);

For further information see the svc_control(3NSL) man page.


Note - For XDR unmarshalling errors, if the server is unable to unmarshal a request, the message is destroyed and an error is returned directly to the client.