EAServer supports two additional event handlers, “Initialization” and “Error”. The initialization handler (or init handler) is used to perform any customization the application requires. Ideally, all of your main() code goes into the init handler. The prototype for all the existing open server event handler remains the same.
typedef CS_RETCODE (CS_PUBLIC * SRV_INITHANDLE_FUNC) PROTOTYPE(( CS_CONTEXT *context, CS_INT argc, CS_CHAR **argv ));
context – is pointer to the CS_CONTEXT structure.
Initialization handlers must return CS_SUCCEED unless an error occurs that prevents the application from running successfully. Returning a value other than CS_SUCCEED aborts the server startup sequence.
You can use the initialization handler or the run handler to initialize your application’s global resources, or you can install handlers for both events. The server log file is not open when the initialization handler is called. If you need to write messages to the log (using JagLog), use a start handler rather than the initialization handler.
Install error handlers through EAServer Manager and not srv_props() or srv_errhandle(). Refer to “Installing event handlers” for more information.
typedef CS_RETCODE (CS_PUBLIC * SRV_ERRORHANDLE_FUNC) PROTOTYPE(( CS_CONTEXT *context, CS_VOID *argp, CS_INT where, CS_SERVERMSG *msg ));
Refer to “Additional event handler information” for information about all event handlers.
Copyright © 2005. Sybase Inc. All rights reserved. |
![]() |