07-05-2010 05:19 AM
Hi,
I'd like to create a background (daemon) application that can display messages from either another Labview application and .net assembly. Both the Labview and .NET assembly parts should be able to 'connect' to the debug window to display the messages they want, all parts are on the same PC. The idea is to log/show any debug messages to a user/developer. Help really appreciated if anyone knows how to do.
Cheers,
LV 8.6.1
Solved! Go to Solution.
07-05-2010 08:55 AM
To be language/platform independent, I would use TCP. The demon can be a normal exe, that is either started manually or placed in the autostart folder. The main issue would be to design the state machine that handles one or multiple connections to the demon.
Felix
07-05-2010 09:28 AM
TCP/IP is a good way to do it.
An alternative is to use the ActiveX server capabilities. You can enable the ActiveX server for your build LabVIEW application, and access it from either LabVIEW or .NET. Not as platform-independent as the TCP/IP solution, though, and there are versioning issues involved with this method.
07-05-2010 10:13 AM
Hi,
Thanks for the quick replies. So do I build a standalone app that listens to TCP connections on a specific port (and address localhost), then any other application (non-specific) can connect to that same address? Sounds almost too easy, are there any examples you could me to?
Thanks,
07-05-2010 10:19 AM
Hi!
There are examples provided with labview (search for TCP/IP).
In particular give a look to the multi-client server example.
Marco
07-06-2010 07:41 AM
Hi,
Possibly being dumb here so forgive me. I've looked at the examples starting with the simple server/client VIs and then the multiple connections VIs. In each case the server is sending data back to the client which is not something I want to do, I want the server to accept multiple clients which send only strings to be displayed in the server front panel, building a concatented log from each client's operations.
When I try to replace the write (existing VI in the example) to a read (plus other changes to this effect) it stops working. I've attached my VIs if someone could shove me in the right direction.
The problem I think is in the server part, where I'm trying to listen to all clients and then display their posted string messages should they have one to post.
Best Regards
07-06-2010 11:19 PM
07-07-2010 04:06 AM
Hi Jack,
Thank you for your comments - and how patiently they came across!
I've attached the latest VIs for anyone who might be interested.
It's not ideal by any means but it sort of works. One issue is that it seems to only increment the '# of connections' counter either after about ~15s (of the client supposedly establishing a connection) or a client sending a message (it doesn't seem to lose messages sent to it). I probably have to change the wait timers but I'm not sure what the optimum values might need to be.
Thanks again.
07-07-2010 08:19 AM
Rather than using the "Number to Decimal String" (which is a lossy conversion), use either "Typecast" or "Flatten to String" found under the "Programming >> Numeric >> Data Manipulation" palette. This will conserve the integrity, bit for bit, of the string length header. Likewise, unflatten from string on the server side, or typecast again to the correct I32 datatype. Currently, you're going to run into problems, especially if the message length exceeds 4 decimal numerals! (10k bytes and above)