Anfang des Inhaltsbereichs

RFC Server Program Working With RfcDispatch and RfcListen  Dokument im Navigationsbaum lokalisieren

Instead of waiting for further RFC call requests, RFC server programs can also ask for further RFC call requests with RfcListen and then issue RfcDispatch for an incoming RFC request. You must only change the main program as follows:

/* main program */

rfc_handle = RfcAccept (...); /* Accept RFC connection */

if (rfc_handle == RFC_HANDLE_NULL) /* Check acceptance of RFC conn. */
{
rfc_error_handling("RfcAccept"); /* Handle error and get error */
return 1; /* specification via RfcLastError */
}

rfc_rc = RfcInstallFunction ( ‘ABC’ , abc_function ,...);
/* Install RFC function ‘ABC’ */
/* under the C-routine */
/* ‘abc_function’ */

if (rfc_rc != RFC_OK) /* Check return code */
{
rfc_error_handling("Install function ‘ABC’);
/* Handle error and get error */
return 1; /* specification via RfcLastError */
}

 

/* Wait for the next RFC request */

do
{
for (rfc_rc = RFC_RETRY; rfc_rc == RFC_RETRY;)
{
rfc_rc =
RfcListen (rfc_handle);
if (rfc_rc == RFC_RETRY)
{
/* while waiting for the next RFC request, do something else */
...
}
}
if (rfc_rc != RFC_OK)
break;

rfc_rc = RfcDispatch (rfc_handle);

}while(rfc_rc == RFC_OK);

RfcClose(...); /* Close RFC connection */