WSGetMessageHandler()
This feature is not supported on the Wolfram Cloud.

WSMessageHandlerObject WSGetMessageHandler(WSLINK link)
returns the message handler function installed for the WSLINK object link.

DetailsDetails

  • The urgent message handler function is called when WSTP receives an urgent message from the other end of the connection.
  • WSGetMessageHandler() returns (WSMessageHandlerObject)0 if link does not have an installed message handler function.
  • WSMessageHandlerObject is a pointer to a function of the form void f(WSLINK link,int m1,int m2).
  • WSGetMessageHandler() is declared in the WSTP header file wstp.h.

ExamplesExamplesopen allclose all

Basic Examples  (1)Basic Examples  (1)

#include "wstp.h"

/* a function to read WSTP urgent messages */

void AppMessageHandler(MLINK link, int m1, int m2)
{
    /* ... */
}


/* check that a link uses AppMessageHandler for urgent messages */

void check_the_message_handler(MLINK link)
{
    WSMessageHandlerObject handler;

    handler = WSGetMessageHandler(link);
    if(handler != (WSMessageHandlerObject)AppMessageHandler)
    {
        if(! WSSetMessageHandler(link, (WSMessageHandlerObject)AppMessageHandler))
            { /* unable to set AppMessageHandler as the handler for
             link */ }
    }
}