Registering AQ Callback function

Can Oracle-8.1.7 which is installed on a Sun-Solaris machine send a notification to a WindowsNT callback function?
I am using OCI for receving notifications from AQ.
If I have Oracle and the Client application running on the same Operating system then everything works fine.
If I run Oracle on Sun-Solaris, and the Client application on WindowsNT, then the client application is NOT able receive notifications from AQ.

Hi,
Kindly check below;
AQ PL/SQL Notification: PL/SQL Callback and Email Notification (Doc ID 225749.1)
Also let me know if there are any Q0** or J0** traces generated.
Thanks,

Similar Messages

  • Register a Callback function in LabVIEW

    Is there any way to register a callback function in LabVIEW. For example:
    I have a DLL on Win2k that run a thread. This thread is doing a certain task (it is not important what it does...) I can't predict when this task will end and I need to know when the task is over. The easy way would be to poll this DLL and ask: "Is it over? Is it over?" over and over again. No! I don't want to poll. Not because it's too easy. I want this DLL to wake me up on time.
    Any idea, solutions, function that I'm not aware of, new features...
    Thanks
    Nitrof

    I think I have a much better solution for you. Here is an example program that show how to set a LabVIEW occurence in a dll. Therefore when your dll is done it can set the LabVIEW occurence, meanwhile your VI is just waiting on the occurence.
    More infomration on this is in the external code in LabVIEW manual Using External Code in LabVIEW
    NOTE:This will ONLY work in LabVIEW 7.
    Attachments:
    SetOccurDll.zip ‏165 KB

  • Callback Function in AQ not launched

    Hi All,
    I have registered a callback function on a queue. When I enqueue it has to call callback function. Below is my scrip for creation of Queue and Enqueue.
    CREATE type xxMessage_typ as object
        ( subject VARCHAR2(30), text VARCHAR2(80));
    =================================================
    BEGIN
    SYS.DBMS_AQADM.CREATE_QUEUE_TABLE(
                      QUEUE_TABLE           =>  'XXKNL_TEST_QTAB'
                     ,QUEUE_PAYLOAD_TYPE    =>  'xxMessage_typ'
                     ,MULTIPLE_CONSUMERS    =>  TRUE);
    END;
    ===============================================
    BEGIN
    SYS.DBMS_AQADM.CREATE_QUEUE(
                      QUEUE_NAME          =>   'XXKNL_TEST_Q'
                     ,QUEUE_TABLE         =>   'XXKNL_TEST_QTAB'
    END;
    ============================================
    BEGIN
    dbms_aqadm.add_subscriber
            ( queue_name => 'XXKNL_TEST_Q',
              subscriber => sys.aq$_agent( 'RECIPIENT', null, null ) );
    SYS.DBMS_AQ.REGISTER ( SYS.AQ$_REG_INFO_LIST( SYS.AQ$_REG_INFO('XXKNL_TEST_Q:RECIPIENT',DBMS_AQ.NAMESPACE_AQ,
                   'plsql://XXKNL_NOTIFYCB',
                    HEXTORAW('FF')
              1
    END;
    ===================================
    BEGIN
      SYS.DBMS_AQADM.START_QUEUE
        QUEUE_NAME => 'XXKNL_TEST_Q'
       ,ENQUEUE => TRUE
       ,DEQUEUE => TRUE
    END;
    ==========================================
    DECLARE
    enqueue_options dbms_aq.enqueue_options_t;
         message_properties dbms_aq.message_properties_t;
         message_handle RAW(16);
         message xxmessage_typ;
    BEGIN
           message := xxmessage_typ('NORMAL MESSAGE',  'This is my Q..' );
           dbms_aq.enqueue(queue_name => 'xxknl_test_q',
                          enqueue_options => enqueue_options,
                          message_properties => message_properties,
                          payload => message,
                          msgid => message_handle);
    end;
    ========================================================
    create or replace procedure xxknl_notifyCB( context raw,
                                              reginfo sys.aq$_reg_info,
                                              descr sys.aq$_descriptor,
                                              payload raw,
                                              payloadl number)
        as
         dequeue_options dbms_aq.dequeue_options_t;
         message_properties dbms_aq.message_properties_t;
         message_handle RAW(16);
        message xxmessage_typ;
       BEGIN
          dequeue_options.msgid := descr.msg_id;
          dequeue_options.consumer_name := descr.consumer_name;
          DBMS_AQ.DEQUEUE(queue_name => descr.queue_name,
                          dequeue_options => dequeue_options,
                          message_properties => message_properties,
                          payload => message,
                          msgid => message_handle);
          insert into xxknl_test values
          ( 'Dequeued and processed "' || message.text || '"' );
          COMMIT;
       END;
    Please let me know if something is missed.
    Thanks
    Rishi

    Hi,
    Kindly check below;
    AQ PL/SQL Notification: PL/SQL Callback and Email Notification (Doc ID 225749.1)
    Also let me know if there are any Q0** or J0** traces generated.
    Thanks,

  • How to create a callback function module

    Hi all,
    I am working in a requirement where we need to call a function module at a 'after change' event. So how to create a callback function module and register it with the crmvevent ?_
    I created a sample function module and try to create entries in table crmv_event_cust, but i got an error message saying that the function module name I provided is not in table CRMC_FUNC_ASSIGN. When I try to create entry there, I got a message that function module is not in CRMC_OBJ_FUNC and that table is a standard table with no maintanance options !!
    looks like i am going in wrong way ... can any one please help ??

    Looking at my system all you need to do is create the entry for the callback function in maint view: CRMV_FUNC_ASSIGN.
    Your entry should be as simple as Z-function name Object Function - <same as others in the segment you are assigning>
    IE for the partner it would be CRM_PARTNER as object function, for general order processing CRM_ORDER
    Take care,
    Stephen

  • Queue with callback function not dequeuing

    Hi,
    I would like to ask you for help or for a hint regarding our problem with the queue:
    A trigger is enqueuing to a queue. This works fine, but the callback function is never called. The queue already worked for a while, but since i changed something at the procedure called by the callback it does not work anymore.
    I already have tried the following:
    -Stopping and restarting
    -Dropping and recreating (with the scheduler having no jobs anymore)
    -Dropping, restarting the database and recreating
    None of these worked. Where do I fail, when considering that the queue with the same scripts worked already? I post the script for creating the queue and adding the subscriber:
    CREATE OR REPLACE TYPE pat_history_queue_payload_type AS OBJECT
    ( TSTAMP VARCHAR2(22 CHAR),
    TYP VARCHAR2(10 CHAR),
    DELTA_MENGE NUMBER,
    ORIGIN VARCHAR2(1 CHAR),
    TEXT VARCHAR2(1000 CHAR),
    QL_TSTAMP VARCHAR2(22 CHAR)
    BEGIN
    DBMS_AQADM.CREATE_QUEUE_TABLE (
    queue_table => 'pat_history_queue_table',
    queue_payload_type => 'pat_history_queue_payload_type',
    multiple_consumers => TRUE
    END;
    BEGIN
    DBMS_AQADM.CREATE_QUEUE (
    queue_name => 'pat_history_queue',
    queue_table => 'pat_history_queue_table',
    max_retries => 10
    DBMS_AQADM.START_QUEUE (
    queue_name => 'pat_history_queue'
    END;
    BEGIN
    DBMS_AQADM.ADD_SUBSCRIBER (
    queue_name => 'pat_history_queue',
    subscriber => SYS.AQ$_AGENT(
    'pat_history_queue_subscriber',
    NULL,
    NULL )
    DBMS_AQ.REGISTER (
    SYS.AQ$_REG_INFO_LIST(
    SYS.AQ$_REG_INFO(
    'pat_history_queue:pat_history_queue_subscriber',
    DBMS_AQ.NAMESPACE_AQ,
    'plsql://PAT.HISTORY_QUEUE_DISTRIBUTION.CALLBACK',
    HEXTORAW('FF')
    1
    END;
    The function CALLBACK which is called by the queue, is never called, I checked that with log messages. Also the package that contains the function is compiled ok.
    Thanks.
    Roland

    Hi,
    Does the subscription show up correct in sys.reg$ ?
    Regards,
    Harry
    http://dbaharrison.blogspot.com/

  • MIDI in using DLL callback function

    I am trying to get MIDI into LV. The dll used is winmm.dll and the function midiinopen (plus others) is described here:
    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/multimed/htm/_win32_midiinopen.asp
    The main problem is I don't know how to program the Call Library Function Node properly in order to perform the call
    plus set it to start receiving callback data, being midi messages. I have tried creating and registering a User Event and
    passing the Event ref to the dll's "dwCallback" and then trapping the callback in an Event Structure, but nothing happens.
    I have studied the "Communicating with a Windows MIDI Device in LabVIEW" example but it gives no hint since midi out
    does not require the use of callbacks.
    Please advice,
    Stefan

    Vedeja wrote:
    I am trying to get MIDI into LV. The dll used is winmm.dll and the function midiinopen (plus others) is described here:
    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/multimed/htm/_win32_midiinopen.asp
    The main problem is I don't know how to program the Call Library Function Node properly in order to perform the call
    plus set it to start receiving callback data, being midi messages. I have tried creating and registering a User Event and
    passing the Event ref to the dll's "dwCallback" and then trapping the callback in an Event Structure, but nothing happens.
    Damn! Need to make this post shorter as this message
    board just silently told me that it needs to be shorter than 5000 words
    and ate up my lengthy repsonse with no way to get it back.
    You can't configure a Call Library Node to pass a Callback function to
    another function. Callback functions have been alien to LabVIEW for a
    long time with good reasons and what it has now as callback function in
    LabVIEw 7.1 and newer is not directly compatible with C callback
    functions.
    Basically as you want to get data from the callback function back into
    LabVIEW there is really no way around some intermediate software layer
    which in this case almost surely means your own specific wrapper DLL
    written in C.
    If you use LabVIEW 7.1 you could use user events but not in the way you
    describe. Attached is an example of how you can use user events from
    external code. Note the extra DLL you will have to write. You have to
    watch out what data you pass back to the user event as it has to match
    exactly the type you configured the user event for, otherwise LabVIEW
    will simply crash on you.
    For numerics this is quite simply and also shown in the example. For
    strings you can't just pass back a C string pointer but you will have
    to allocate a LabVIEW string handle with
    handle = DSNewHandle(sizeof(int32) + <length of C string>)
    and then copy the C string into it. For specifics about how to do this
    you should refer to the External Code reference manual in your Online
    Bookshelf. Similar rules apply for arrays or clusters for that matter.
    If you want or need to do this for LabVIEW < 7.1 there are two
    possible approaches but both are even less trivial. You could either
    create a wrapper DLL that translates your callback events into LabVIEW
    occurrences and for the data transfer back to LabVIEW you would have to
    implement your own queing too, or you could use the Windows Message
    Queue example somewhere here in the NI examples and adapt it to return
    your specific data. That would solve the data queueing more or less for
    you without having to worry about that.
    Rolf Kalbermatter
    Message Edited by rolfk on 05-22-2006 11:22 AM
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions
    Attachments:
    userevent.zip ‏27 KB

  • Recursive ActiveX register event callback VI

    Hi!
    I am trying to control a motor in LV2013 using the ActiveX concept. When I use a "register event callback VI" function, can I call the same VI that calls a VI (with the "stop rule" controlled be the user data terminal, of course, inside)? By default, callback Vis that one can create for this are all reentrant (preallocated clone) and synchronious (according to help). However, both when I use the "server VI reference" ("This VI") and when I create a reference and browse for the same file - "register event callback" shows me a broken wire.

    _Basil_ wrote:
    As far as I understood, putting a  movement method in the loop will not give any result, so I tought in the direction of the recursive callback. However, I found this post. Would you in general agree that the callback VI cannot be recursive? I attach my code in LV13 (if you need me to convert, I will)
    Sorry, I'm still on LabVIEW 2012 here, so can't look at your VIs. I don't understand your comments in these sentences though. What do you mean by putting a movement method in a loop will not give any result? And why would you ever want a recursive callback? The callback is called each time the event occurs. There's no sense in making it recursive, nor would you want to re-register for a callback on an event inside a callback VI. Normally a callback should contain very little logic; it should primarily pass some piece of information (through a queue, user event, etc) back to the main thread and let the main logic handle it.

  • Queue with callback function - strange behaviour when using max_retries

    Hi,
    I hope someone can tell me what is wrong or can explain the following strange behaviour to me.
    I am using one queue with a registered callback function. To test the behavoiur in case of an error I tested different settings, with or without explicit exception queue and with or without parameter max_retries.
    Database Version is 11.2.0.2.   Enterprise Edition
    I enqueue 10 messages in a loop.
    I define no exception queue and do not set max_retries
    ==> all messages stay in the queuetable with q_name = AQ$_... (implicit exception queue) and retry_count = 5
    I define no exception queue and set max_retries = 4
    ==> 1 message stays in the queuetable with q_name = AQ$_... (implicit exception queue) and retry_count = 4
           9 messages stay in the queuetable with q_name = nomal queue name and retry_count = 0
    I define an exception queue and set max_retries = 4
    ==> 1 message is transfered to the Exception Queuetable with retry_count = 4
           9 messages stay in the normal Queuetable and retry_count = 0
    I define an exception queue and do not set max_retries
    ==> all 10 messages are transferred to the Exception Queuetable with retry_count = 5
    I have no explanation for the behaviour in case 2 and case 3.
    To create the queue and the callback I use this code (reduced to minimum):
    begin
       DBMS_AQADM.CREATE_QUEUE_TABLE(Queue_table        => 'TESTUSER.TEST_TABELLE'
                                   , Queue_payload_type => 'SYS.AQ$_JMS_TEXT_MESSAGE'
                                   , sort_list          => 'enq_time'
                                   , multiple_consumers => FALSE
       DBMS_AQADM.CREATE_QUEUE( queue_name  => 'TESTUSER.TEST_QUEUE'
                              , queue_table => 'TESTUSER.TEST_TABELLE'
    --                          , max_retries => 4                     uncomment this line to set max_retries
    -- uncomment the following Block to use an explicit Exception Queue
    /*   DBMS_AQADM.CREATE_QUEUE_TABLE(Queue_table        => 'TESTUSER.TEST_TABELLE_EXC'
                                   , Queue_payload_type => 'SYS.AQ$_JMS_TEXT_MESSAGE'
                                   , sort_list          => 'enq_time'
                                   , multiple_consumers => FALSE
       DBMS_AQADM.CREATE_QUEUE( queue_name  => 'TESTUSER.TEST_QUEUE_EXC'
                              , queue_table => 'TESTUSER.TEST_TABELLE_EXC'
                              , queue_type  => dbms_aqadm.EXCEPTION_QUEUE);
       DBMS_AQADM.START_QUEUE('TESTUSER.TEST_QUEUE');
    end;
    create or replace procedure test_procedure
      (context  RAW
      ,reginfo  sys.AQ$_reg_info
      ,descr    sys.AQ$_descriptor
      ,payload  VARCHAR2
      ,payloadl NUMBER
      ) authid definer
      IS
      -- für Queue
      dequeue_options   DBMS_AQ.dequeue_options_t;
      message_prop      DBMS_AQ.message_properties_t;
      message_hdl       raw(16);
      message           sys.aq$_jms_text_message;
      l_daten           VARCHAR2(32767);
      ex_hugo          EXCEPTION;
      BEGIN
        dequeue_options.msgid         := descr.msg_id;
        dequeue_options.consumer_name := descr.consumer_name;
        dbms_aq.dequeue(descr.queue_name, dequeue_options, message_prop, message, message_hdl);
        -- to provoke an error
        RAISE ex_hugo;
        -- regurlar coding
        commit;
    exception
      when others then
           rollback;
           RAISE;
    end;
    DECLARE
       reginfo1    sys.aq$_reg_info;
       reginfolist sys.aq$_reg_info_list;
    BEGIN
       reginfo1 := sys.aq$_reg_info('TESTUSER.TEST_QUEUE', DBMS_AQ.NAMESPACE_AQ, 'plsql://TESTUSER.TEST_PROCEDURE?PR=0',HEXTORAW('FF'));
       reginfolist := sys.aq$_reg_info_list(reginfo1);
       sys.dbms_aq.register(reginfolist, 1);
       commit;
    END;
    to enqueue my messages i use:
    DECLARE
      message            sys.aq$_jms_text_message;
      enqueue_options    dbms_aq.enqueue_options_t;
      message_properties dbms_aq.message_properties_t;
      msgid              raw(16);
      v_daten            clob;
    BEGIN
       message := sys.aq$_jms_text_message.construct;
       for i in 1..10
       loop
          v_daten := '{ dummy_text }';
          message.set_text(v_daten);
    -- uncomment the following line to use an explicit Exception Queue     
    --      message_properties.exception_queue := 'TESTUSER.TEST_QUEUE_EXC'; 
          dbms_aq.enqueue(queue_name         => 'TESTUSER.TEST_QUEUE',
                          enqueue_options    => enqueue_options,
                          message_properties => message_properties,
                          payload            => message,
                          msgid              => msgid);
          message.clear_properties();
       end loop;
       commit;
    END;

    Hi Chris,
    I tried to reproduce your complaint, but was unable to. I didnt use auditting however, just a series of "select user from dual" with proxy authentication. You might want to see if you can put together a small complete testcase for this and open a sr with support.
    Cheers
    Greg

  • Declaring Callback Functions in CSXS Extension (for Flash)

    A few features offered in Flash's scripting language are handful of event listeners you can attach to Flash that will in tern call any associated JSFL function you've attached to them while Flash is running. You can then listen for events like "documentNew", "documentChange", "mouseMove", etc.
    JSFL Code Would Look Something Like this:
    fl.addEventListener("documentOpened", myDocumentOpenedHandler);
    function myDocumentOpenedHandler()
         swfObject.call("callBackFunction_InsideFlashPanel");
    My swfPanel registers a callback function, "callBackFunction_InsideFlashPanel" which would handle the event inside the panel.
    This is a way of ensuring my Panel is notified when a change takes place in Flash.
    Adobe has an article about it here:
           http://help.adobe.com/en_US/Flash/10.0_ExtendingFlash/WS4B030CF7-0681-47e3-9E2C-9A6D799980 AA.html
    My question is, how should this be implemented in a CS Extension using the CS SDK?
    Thanks,
    Clint G.

    Right. The whole point of the question is if is possible to
    dynamically declare functions for use as callbacks.
    For example, in the standard loading functions, you register
    a callback like this:
    var load:Loader = new Loader();
    var req:URLRequest = new URLRequest(swf);
    load.contentLoaderInfo.addEventListener(Event.COMPLETE,
    swfloadcallback);
    load.load(req);
    function swfloadcallback(e:Event):void
    The problem with the standard callback function is that I
    can't add additional arguments to it. For example, I couldn't have
    swfloadcallback take in an additional argument (for example the
    index of the swf I'm trying to load). What I'm wondering is if in
    actionscript 3 it's possible to dynamically declare callbacks such
    that I only have to write the code once, but in essence I am adding
    additional parameters to the callback.
    Hence the example I listed above. What I was trying to
    accomplish there was basically dynamically creating callbacks that
    understood which index to insert the loaded image into. But clearly
    that example doesn't work.

  • How to write c wrapper it containing callback functions

    hi here shambhu below call can be containing some call back functions ,how can create wrapper for this,please suggest me
    _export int GDSRegisterStation(char *sPort, char* sPanel, int iStation, GDSCallback lpGDSTaskCall); /*
    This call hooks up user application onto the GDS environment. From this point on, the GDS application has continuous, concurrent access to the virtual machine representing the test system. As multiple independent test systems may be hooked onto the same host computer, the call needs to specify a "Port" (unsigned uPort) to which GDS memory access is sought. Character string sPanel (up to 63 chars) identifies the calling GDS task to the Virtual Machine. This entry will assist the System Manager in monitoring active GDS tasks by their assigned names. As multiple test stations (each with one or more control channels) may be associated with the same controller, (int) iStation specifies the station to which this application will be connected. (GDSCallback) lpGDSTaskCal specifies the subroutine in the user application that is to be installed as the real-time callback into the Virtual Machine. From this moment on, the specified subroutine will be automatically called by the Virtual Machine to periodically All subsequent calls to the GDS library will apply to this Station and its control channels. This call is made only once and prior to other GDS calls. 0 is returned upon normal completion -1 is returned if the call was a failure due to absence of GDS space associated with the call. Make sure station is connected and On-Line and make sure Port No was correct in the call -2 is returned if the application was already registered by a previous call

    You will have to write a wrapper DLL in C which converts the callback event into a LabVIEW compatible event. The most versatile way would be to generate a user event with the PostLVUserEvent() LabVIEW manager function. Callback functions are however an advanced C programming construct, so you should definitely have a pretty decent understanding of C programming before starting this endeavour. Otherwise you end up with a not working solution or maybe even worse, one that seems to work sometimes but doesn't really do the right thing.
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • Calling a method from a callback function under ARC

    Hi All
    I previously wrote some HIDManager software. The HIDManager references were done in a Objective C class so within this object you have the code:
        IOHIDManagerRegisterDeviceMatchingCallback( k8055HIDManager, k8055BoardWasAdded, (__bridge void*)self );
    Which registers with the HIDManager
    The Callback function which is outside the class was as follows:
    static void k8055BoardWasAdded(void* inContext, IOReturn inResult, void* inSender, IOHIDDeviceRef k8055HIDDevice)
        IOHIDDeviceOpen(k8055HIDDevice, kIOHIDOptionsTypeNone);
        CCVellemanK8055Driver * k8055 = (__bridge CCVellemanK8055Driver *)inContext;
        [k8055 setHardwareConnectionStatus : YES];
    Any how my problem is in converting the code to ARC as under OS X 10.9 SDK and 64bit I'm now getting a EXC_BAD_ACCESS (Code=EXC_I386_GPFLT) at this line
        CCVellemanK8055Driver * k8055 = (__bridge CCVellemanK8055Driver *)inContext;
    although removing the method
    [k8055 setHardwareConnectionStatus : YES];
    will alow it to build but then obviously the app won't work as required.
    Could someone suggest a ARC safe way of accessing the passed instance so I can again call methods on it.
    Cheers
    Steve

    Try using blocks instead. This is the callback I am using for libcurl.
    static size_t callback(
      void * contents, size_t size, size_t nmemb, void * context)
      size_t (^block)(void *, size_t) =
        (__bridge size_t (^)(void *, size_t))context;
      size_t result = block(contents, size * nmemb);
      return result;

  • Problem with register event callback in use of instrument control

    now, i use the register event callback to register a value change of a boolean control on the front panel, and wire the cluster's ref of the instrument control parameters to the user parameter input, then create the callback vi. In the callback vi, i select the pump-control subvi, and pass the user parameter to the subvi. The problem is that,  when i press the boolean control, the instrument (here is pump) can act, but immediately, the code crashes.
    I use labview 8.6
    Attachments:
    callback vi.png ‏8 KB
    register event callback.png ‏8 KB

    You would wire the event registration wire that comes out of the Register for Events node into an event structure.  You will need to right click on the event structure and check off "Show Dynamic Event Terminals" and it into that.  Then you can create a new Event Case that uses the dynamic event.  You can place your subVI in that event in whatever way you want.  (Just drop the subVI in or do a Call by Reference there, or whatever.)  Look in the Example Finder for "Dynamically Register for Events.vi".

  • How to change the Callback function of a GUI button?

    I would like to change the callback function associated with a GUI button dynamically in the programming way.
    Here is the code piece I tried, but it does not seem to work:
    const char* pstrLabelSaveJpeg = "SaveJpegCb";
    SetCtrlAttribute(pahel_id, ctrl_id ,ATTR_LABEL_TEXT, pstrLabelSaveJpeg);
    int CVICALLBACK SaveJpegCb(int panel, int control, int event, void *callbackData, int eventData1, int eventData2);
    Solved!
    Go to Solution.

    The attribute you used is about the "label" of the button.
    It is just an appearence attribute. You can write your own name on it, but that does not change the callback function.
    You should change the ATTR_CALLBACK_FUNCTION_POINTER attribute, and you should not pass the function name as a string.
    So your function call will look like this:
    SetCtrlAttribute(pahel_id, ctrl_id, ATTR_CALLBACK_FUNCTION_POINTER, SaveJpegCb);
    Of course, you have to declare the SaveJpegCb function somewhere above that line.
    I think you have already done that.
    S. Eren BALCI
    www.aselsan.com.tr

  • TCP Callback function passing data to teststand

    Hi,
    I'm trying to pass data via a TCP Callback function to teststand using the TCP steptype that I downloaded from Ni.
    When I open a connection, container data is passed to the dll on which it creates a connection, the dll in part creates a TCP Callback function.
    The handle obtained from the connection is then passed back through the container data, and the dll returns back to the sequence editor which will execute the next steps.
    The problem is that when the TCP Callback function gets an TCP_READY event it can not pass data to TestStand because it can not access the container data.
    How can this TCP Callback function pass/alter data to/in Testand?
    Thank you...

    Yes ThiCop,
    That's exactly what I want to establish!
    Here is the example code:
    //Function needed by the TCP functions
    int CVICALLBACK MsgHandler (unsigned handle, int event, int error, void *callbackData)
        char receiveBuf[256] = {0};
        char displayBuf[7] = {0};
        char * tempLookup;
        int  dataSize = sizeof (receiveBuf) - 1;
       switch (event)
          case TCP_CONNECT:
             break;
          case TCP_DISCONNECT:
             break;
          case TCP_DATAREADY:
             if ((dataSize = ClientTCPRead (handle, receiveBuf, dataSize, 1000)) > 0)
                   //  Send data from receiveBuf to a variable in teststand ????
                   //  TS_PropertyGetValString (HandleObject, NULL, "Step.Result.Data", 0, &tempLookup);
                   //  TS_PropertySetValString (HandleObject, NULL, tempLookup, 0, receiveBuf);
             else
                   receiveBuf[dataSize] = '\0';
            break;  
     return 0;
    void __declspec(dllexport) TX_TEST TCPConnectF(tTestData * testData, tTestError * testError)
        int                 error = 0;
        int                 TCPerror;
        double           Port;
        double           Timeout;
        char              *HandleLookup;
        char              *ServerAdd;
        char              *CallbackData;
        ErrMsg           errMsg = {'\0'};
        ERRORINFO   errorInfo;
        tsErrChk (TS_PropertyGetValString (testData->seqContextCVI, &errorInfo, "Step.Result.Handle", 0, &HandleLookup));
        tsErrChk (TS_PropertyGetValNumber (testData->seqContextCVI, &errorInfo, "Step.Result.Port", 0, &Port));
        tsErrChk (TS_PropertyGetValString (testData->seqContextCVI, &errorInfo, "Step.Result.IP", 0, &ServerAdd));
        tsErrChk (TS_PropertyGetValNumber (testData->seqContextCVI, &errorInfo, "Step.Result.Timeout", 0, &Timeout));
        tsErrChk (TS_PropertyGetValString (testData->seqContextCVI, &errorInfo, "Step.Result.Data", 0, &CallbackData));
        TCPerror = ConnectToTCPServer (((unsigned int *) &ConnectionHandle), ((unsigned int) Port), ServerAdd, MsgHandler, 0, Timeout);
        if (TCPerror != 0)
         //Get TCP Error Message
           sprintf(errMsg,"%s",GetTCPErrorString ( TCPerror ));
           error = TCPerror;
           goto Error;
        tsErrChk (TS_PropertySetValNumber (testData->seqContextCVI, &errorInfo, HandleLookup, 0, ((double) ConnectionHandle)));
    Error: 
        // FREE RESOURCES
        CA_FreeMemory(HandleLookup);
        CA_FreeMemory(ServerAdd);
        // If an error occurred, set the error flag to cause a run-time error in TestStand.
        if (error < 0)
            testError->errorFlag = TRUE;
            testError->errorCode = error;
            testData->replaceStringFuncPtr(&testError->errorMessage, errMsg);
        return;   

  • JNI Multithreading/Callback Function Design Issues

    Ok, I have been working on this for quite some time now and I simply can not figure it out. So any ideas are more than welcome. :)
    I have Java code that uses a DLL that I created in C++. My C++ code links with a library made by a 3rd party (don't have access to the source or anything). The 3rd party's code creates a new thread and calls a callback function that I define in my C++ code. This callback is called continuously until I perform some other code to stop it. Now for the tricky part. In my callback function I need to pass some data back in Java. Here is where my design falls apart. Since the callback function is technically part of the 3rd party's thread, I have to call AttachCurrentThread() in the callback to get the JNIEnv pointer in order to ultimately call my desired Java method. The problem is that my Java method (or even the C++ callback function) are only invoked if I do a sleep() in my C++ code after I start the 3rd party code which creates the thread. If I do a Thread.sleep() in Java after I call the native function code, it just sleeps and the callbacks never get called. It appears as though the thread dies as soon as I return from my C++ code.
    So now I am stuck. I have tried creating a thread in Java which simply calls the C++ code and the C++ code just loops waiting for an updated flag, however, this causes the 3rd party's thread creation code to fail (not quite sure why). However, even if their code worked, I'm not convinced this is even proper design. I apologize if this is simply a threading design principle as my multithreading programming techniques are a bit rusty and I've never done a multithreaded application this complex (this is a simplified version, but the idea is the same).
    I welcome any suggestions or even documentation that may lead me in the right direction. Thanks in advance.

    I have a similar issue.
    from java I call a dll I wrote, which calls a third party scanner dll (cyber.dll). Everything works ok, except, when an event in the scanner occurs, it calls the call backin my dll, which calls the callback in java, which kills the vm with an access violation. If I execute the call back to java from a c method which I just called from java, it works, but if it gets called outside of the java execution of the native code, it fails.
    I havent done anything with treads or syncronisation. Do I need to do this AttachCurrentThread stuff? If so, where do I get the _jvm handle as Im not starting the vm from c?                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

Maybe you are looking for