NonStop Servers
1832275 Members
2112 Online
110041 Solutions
New Discussion

AWAITIOX with SERVERCLASS_SENDL_ in nonstop HPE systems

 
nonstopNoob
Visitor

AWAITIOX with SERVERCLASS_SENDL_ in nonstop HPE systems

Hi All,

I'm new to Non Stop and I've written a C program that invokes a SERVERCLASS_SENDL_ that then calls a rest API. This API returns a 200 with a valid response. However when I tried converting this procedure call to be asynchronous using AWAITIOX, there is an error. The API call still returns 200 but the AWAITIOX fails to wait for the operation to complete.

I have just started NonStop programming, any guidance in this direction is appreciated. Thanks!

 

In the following code snippet it alwys ends up in the if block event ==-1, and prints "AWAITIOX failed with error code -1" :

 

 

/* Initiate the asynchronous SERVERCLASS_SENDL_ operation */
    result = SERVERCLASS_SENDL_(
        (char*)pathmon_name, (short)strlen(pathmon_name),
        I_serverclass, (short)strlen(I_serverclass),
        (char*)&con_records_rq, (char*)&con_generic_response,
        sizeof(con_records_rq), sizeof(con_generic_response)
    );

    if (result != 0) {
        printf("SERVERCLASS_SENDL_ failed with error code %d\n", result);
        return con_generic_response;
    }

    /* Use AWAITIOX to wait for completion of the operation */
    event = AWAITIOX(&server_class_filenum, &buffer_addr, &count_transferred, &tag, timelimit, &segment_id);

    if (event == -1) {
        printf("AWAITIOX failed with error code %d\n", event);
        return con_generic_response;
    }

    if (buffer_addr != 0) {
        printf("Asynchronous operation failed with buffer_addr %d\n", buffer_addr);
        return con_generic_response;
    }

 

 

 

2 REPLIES 2
Mr_Techie
Trusted Contributor

Re: AWAITIOX with SERVERCLASS_SENDL_ in nonstop HPE systems

@nonstopNoob 

- Make sure SERVERCLASS_SENDL_ returns a success code (0). If not, log the error and exit early and cross check if server_class_filenum is correctly initialized and corresponds to the active server class file descriptor.[ Initialize buffer_addr to 0 before calling AWAITIOX and set a reasonable timelimit (e.g., 100 ticks) to avoid premature timeouts.]

- If AWAITIOX fails, use ERRNO_() to retrieve a detailed error code instead of just checking for -1. Log errors and handle them accordingly.

- make sure  server class is running and properly handling the message using MSGMON. Review the timeout (timelimit) to ensure the operation completes before timing out.

Let me know if you need further clarification!

 

support_s
System Recommended

Query: AWAITIOX with SERVERRCLASS_SENDL_ in nonstop HPE systems

Hello,

 

Let us know if you were able to resolve the issue.

If you are satisfied with the answers then kindly click the "Accept As Solution" button for the most helpful response so that it is beneficial to all community members.

 

 

Please click on "Thumbs Up/Kudo" icon to give a "Kudo".


Accept or Kudo