OpenTP1 Version 7 Programming Reference C Language

[Contents][Index][Back][Next]

dc_rpc_mainloop - Start an SPP service

Format

ANSI C, C++

#include <dcrpc.h>
int  dc_rpc_mainloop (DCLONG flags)

K&R C

#include <dcrpc.h>
int  dc_rpc_mainloop(flags)
DCLONG     flags;

Description

The function dc_rpc_mainloop() starts the receiving of service requests to a service function of the SPP which is being executed in the process. The function dc_rpc_mainloop() must be called in the main function. Call the function dc_rpc_mainloop() only once in the process.

The function dc_rpc_mainloop() does not return until it receives a termination request from OpenTP1. The function dc_rpc_mainloop() receives a termination request from OpenTP1 in the following cases:

Argument whose value is set in the UAP

flags

Specify DCNOFLAGS.

Return values

Return value Return value (numeric) Explanation
DC_OK 0 A termination request was received from OpenTP1. Execute termination processing for the SPP immediately, then call the function dc_rpc_close() and exit().
DCRPCER_INVALID_ARGS -301 The value specified for the argument is invalid.
DCRPCER_PROTO -302 The function dc_rpc_open() was not called.
The function dc_rpc_mainloop() or the function dc_mcf_mainloop() was called.
DCRPCER_FATAL -303 The SPP service could not be started.

Notes

The function dc_rpc_mainloop() returns when it receives a termination request from OpenTP1. However, the function dc_rpc_mainloop() does not return but the process terminates in the following cases:

  1. The SPP enters a termination process because the OpenTP1 forced termination command (dcstop -f command) or server forced termination command (dcsvstop -f command) is executed.
  2. A process terminates abnormally because the UAP or OpenTP1 malfunctions.
  3. The service function issues abort() or exit().
  4. Hardware, the operating system, or OpenTP1 causes an error.

Even if the SPP is created in such a way that termination processing will be executed after the function dc_rpc_mainloop() terminates normally, the processing is not executed in the above cases.