Jump to content

how to communicate between C# window application and Labview for data sharing?


Recommended Posts

Hi,

I have an existing c# window application. I want to make my Labview to communicate with C# application whenever an event happens and vice versa. Please let me know what will be the best way for the communication while making little changes to the C# window application. Running on windows XP machine with VS 2005.

Edited by Geeta Tirlapur
Link to comment

You haven't included enough information for anyone to give you a specific suggestion. There is no single "best" way to communicate between apps; it all depends on your requirements and restrictions. Here are a couple options; there are others as well.

Tightly coupled solution:

  1. To notify the C# app of events in the LV app
    1. Add code to your .Net app exposing public methods telling the app something happened in the LV app.
    2. In your LV app use the .Net constructor node to get a reference to your .Net app.
    3. When events of interest occur in the LV app call the appropriate methods in the .Net app.

[*]To notify the LV app of events in the C# app

  1. Use callbacks in your LV code. (I haven't done this so I can't comment on how to change your C# code to allow it.)

This solution makes your LV source code dependent on the C# executable. In other words, you'll have to have the C# app installed on your dev computer and on any computer that executes the LV app.

Loosely coupled solution:

  1. Add a TCP component to your LV app.
  2. When something interesting happens in the LV app, broadcast a message on the TCP port.
  3. At the same time, constantly listen on the TCP port for messages broadcast by other apps. When a message is received, react accordingly.
  4. Repeat steps 1-3 for the C# app.

This solution removes the dependencies between the two applications. Neither app "knows" about the other one. They only know they are supposed to broadcast messages when stuff happens and do other stuff when messages are received.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.