CltSend

Synopsis

    #include "cltsrvr.h"
    int CltInit( Server_Def *def );
    int CltSend( Server_Def *def, void *smsg, void *rmsg, int sbytes, int rbytes );
    int CltSendmx( Server_Def *def, unsigned sparts, unsigned rparts,
               struct _mxfer_entry *smsg,
               struct _mxfer_entry *rmsg );
    

Description

CltInit() and CltSend() provide a general approach to writing Client/Server applications. Based on a configuration structure for a specific server, these functions perform many of the routine tasks involved in maintaining communication between the client and the server. They will locate the server, report errors if the server disappears, and even attempt to reconnect to the server in case it is restarted.

CltInit() is charged with locating the server (if it has not already been located) without actually sending it any messages. It is not necessary to call CltInit() before calling CltSend(), but some applications will prefer to report problems earlier rather than later.

CltSend() is a cover for the QNX Send() function. It verifies only that the transaction was successful, but does not attempt to interpret the reply data.

CltSend() will restart transactions which are interrupted by signals. If you wish to have signals abort a CltSend(), you will need to use sigsetjmp() and siglongjmp().

CltInit() and CltSend() deal with errors using the minimum value of nl_response and def->response. i.e. a client which normally dies when the server isn't present can be made to warn only via set_response(1). Similarly, even if nl_response is set to 3, a particular server may never warrant a fatal error, so def->response may be set to 1 or 2 (or even 0) to allow for non-fatal responses.

Returns

Both functions return zero on success and -1 otherwise.

See Also

Client/Server functions.

Source File

/usr/local/src/nortlib/cltsrvr.c

Alphabetical List
Subject List
Return to Manuals Page
webmaster@huarp.harvard.edu
Copyright 2001 by the President and Fellows of Harvard College