dc_rap_connect - Establish a connection with a RAP-processing listener

Format

ANSI C, C++

#include <dcrap.h>
int dc_rap_connect(char *target_host, DCLONG target_port,
                  DCRAP_SV_ID *sv_id, DCLONG rflags)

K&R C

#include <dcrap.h>
int dc_rap_connect(target_host, target_port, sv_id, rflags)
char        *target_host;
DCLONG      target_port;
DCRAP_SV_ID *sv_id;
DCLONG      rflags;

Description

The function dc_rap_connect establishes a connection between a RAP-processing listener and a RAP-processing client.

The RAP-processing listener with which a connection is to be established is the RAP-processing listener that was activated at target_port on target_host.

Arguments whose values are set in the UAP

target_host ((1 to 255 alphanumeric characters, periods, or hyphens))

Specify the host name of the OpenTP1 node on which the RAP-processing listener was activated.

target_port <unsigned integer> ((1 to 65535))

Specify the port number of the well-known port being used by the RAP-processing listener.

rflags

Specify DCNOFLAGS.

Arguments whose values are returned from OpenTP1

sv_id

A service ID is returned when the function dc_rap_connect terminates normally or DCRAPER_ALREADY_CONNECT is returned.

Return values

Return valueReturn value (numeric)Explanation
DC_OK0Normal termination. A connection was established with the RAP-processing listener.
DCRAPER_PARAM-5501The value specified for the argument is invalid.
DCRAPER_PROTO-5502The protocol is invalid. A possible cause is as follows:
  • The function dc_rpc_open was not called.
  • Although the rpc_rap_auto_connect operand in the user service definition had been set to Y, the function dc_rap_connect was called.
  • The -w option was not specified in the dcsvgdef definition command in the user service network definition.
DCRAPER_NOMEMORY-5503The memory became insufficient.
DCRAPER_MAX_CONNECTION-5517The specified value exceeds the maximum number of dc_rap_connect functions which can be called from a single process.
DCRAPER_NETDOWN-5505A network error occurred during communication with the RAP-processing listener.
DCRAPER_TIMEDOUT-5506A timeout occurred during communication with the RAP-processing listener.
DCRAPER_NOSOCKET-5507The number of sockets became insufficient.
DCRAPER_NOHOSTNAME-5508The host name cannot be resolved.
DCRAPER_SHUTDOWN-5521The RAP-processing listener is being terminated.
DCRAPER_NOCONTINUE-5522An error which prevents continuation of processing occurred. Possible causes of the error are as follows:
  • An unexpected message was received.
  • A message was received unexpectedly from a remote system.
DCRAPER_SYSCALL-5523An unexpected error occurred during system call.
DCRAPER_UNKNOWN_NODE-5531An attempt was made to establish a connection with a RAP-processing listener which is on an unconnected network.
DCRAPER_NOMEMORY_SV-5520The memory became insufficient on the RAP-processing listener or RAP-processing server.
DCRAPER_TIMEOUT_SV-5532A connection could not be established within the message exchange monitoring time specified in the rap_watch_time operand of the RAP-processing listener service definition.
DCRAPER_PANIC_SV-5533A system error occurred in the RAP-processing listener.
DCRAPER_MAX_CONNECTION_SV-5534The specified value exceeds the maximum number of requests which can be accepted for connection with a RAP-processing client that is managed by a RAP-processing listener.
DCRAPER_NOSERVICE-5528The RAP-processing listener is being started or terminated.
DCRAPER_ALREADY_CONNECT-5529A connection has already been established with the RAP-processing listener.

Note

If the function dc_rap_connect returns with an error (returns with a value other than DCRAPER_ALREADY_CONNECT), connection was not established with the RAP-processing listener.

The error code acquired by the UAP trace is as follows:

0: No error
1: The function dc_rpc_open() was not called.
3: The value specified for the host name contains an error.
4: The value specified for the port number contains an error.
5: An area for storing the service ID was not specified.
6: The dc_rap_connect() function was called while the value Y was specified in the rpc_rap_auto_connect operand in the user service definition. Alternatively, the user service network definition has not been defined.