NI Home > Community > NI Discussion Forums

Components

Showing results for 
Search instead for 
Do you mean 
Reply
Member
Garcas
Posts: 36
0 Kudos

Re: Simple TCP Messaging (STM)

I am developing a DAQ application (just streaming for a fixed period of time since a trigger arrives) that will run in a PXI-8105 embedded controller and use a PXI-6115 DAQ card. The application will operate in a headless configuration receiving commands remotely thorugh a TCP/IP connection to the PXI8105 using a HTTP based protocol.

Someone will develop the remote (client) side in someother language (not LabVIEW), but I have to develop the server side in my application to receive the commands, act as ordered and respond with the data

I wonder if STM can be of any help to develop this HTTP Server or if I should start from zero and use the TCP/IP functions provided with LabVIEW. I am using LabVIEW 8.5

Thanks for your help

Active Participant
Christian_L
Posts: 662
0 Kudos

Re: Simple TCP Messaging (STM)

Garcas,

If you need to develop an HTTP server you should use the low level TCP/IP functions, and not use STM. STM is a higher level protocol based on TCP/IP, designed to transfer packets of data or commands between two systems. It includes specific header information in each packet that identifies the contents of the packet. Because of this protocol specific content, you can not use it to create the HTTP protocol. In effect STM is in parallel to HTTP, as both protocols are based on TCP/IP.

However, STM is designed specifically for applications like you describe. So if possible, you may want to consider using STM instead of HTTP for your solution. STM is an open protocol and you can implement an STM client in any programming language that supports TCP/IP communication.

Christian Loew, CLA
Principal Systems Engineer, National Instruments
Please tip your answer providers with kudos.

Any attached Code is provided As Is. It has not been tested or validated as a product, for use in a deployed application or system,
or for use in hazardous environments. You assume all risks for use of the Code and use of the Code is subject
to the Sample Code License Terms which can be found at: http://ni.com/samplecodelicense
Member
Garcas
Posts: 36
0 Kudos

Re: Simple TCP Messaging (STM)

 

Thanks Christian, it's what it looked to me but I wanted to be sure I wasn't missing something before starting from scratch. My problem is that using HTTP is an application requirement, so I cannot do anything. Is there anything around so I don't have to start from 0? I read some threads that in the "old" Internet Toolkit there was an HTTP server, but I guess it didn't come with the complete code so I could modify it to my specific needs

 

Anyhow I think STM it's a great tool... and free ! So congratulations to the authors. I'll definitively copy some ideas

Active Participant
Brian_K.
Posts: 242

Re: Simple TCP Messaging (STM)

I know this question was posted in September 2007, but:



Auden wrote:
can a VI using STM be used as a TCP/IP server when the client computer does not use STM but jsut the "standard" TCP/IP?
 
Any tutorial or example you may be able to point me to?
 
Much thanks


I have an example of how to implment a STM client in CVI (ANSI C).  It is attached below.  What you do is open "STM Example.lvproj" and run the STM Server Example.VI on a real-time target (you will need to change the IP address in the project).  Then open the STM for CVI client.cws.  Run that example. 

Even if you are not using CVI, the STM_Comm.c and STM_Convert.c should be  a good starting point.
Brian K.
Active Participant
DirkW
Posts: 1,118
0 Kudos

Re: Simple TCP Messaging (STM)

I have a problem with  STM to work in my startup EXE running on a cFP 2120 controller. I do not get connection to this EXE. Everything works fine and as expected if i start and deploy it from my LabVIEW development environment. What is the problem with the Executable? Is there anything I need to install on my target system, that is not coming with the Executable?

Any comment is highly appreciated.

 

DirkW

Active Participant
Christian_L
Posts: 662
0 Kudos

Re: Simple TCP Messaging (STM)

Dirk,

 

STM does not require anything special to run in an executbale as it is completely based on TCP and written in LV code.

 

It sounds like there is an issue establishing a TCP connection to your executable or some other fundamental issue. Can you ping the cFP controller at the IP address that you are using for your TCP connection?

Christian Loew, CLA
Principal Systems Engineer, National Instruments
Please tip your answer providers with kudos.

Any attached Code is provided As Is. It has not been tested or validated as a product, for use in a deployed application or system,
or for use in hazardous environments. You assume all risks for use of the Code and use of the Code is subject
to the Sample Code License Terms which can be found at: http://ni.com/samplecodelicense
Active Participant
Jack_A.
Posts: 245
0 Kudos

Re: Simple TCP Messaging (STM)

I am posting a beta version of the next revision of the STM library.  Attached below is a .zip file which can be unzipped to the user.lib directory.

 

The major changes in this version of STM are the additon of serial and UDP as communication mechanisms along with TCP/IP.  There are also changes to the API to make the VIs easier to use. 

 

We would like to hear your feedback (regarding either features or bugs) with this version of STM.  Please post any feedback on this forum.

 

Note that the documentation and examples are not yet finished.

 

Thanks,

Jack

Member
Marc Blumentritt
Posts: 121

Re: Simple TCP Messaging (STM)

Hi,

 

funny thing you posting a beta of a new version of the STM tools, since I just did some small optimizations over christmas on the published STM tools. Some things you changed already, but I have two remarks on the code (s. attachment).

 

A question: is this version of STM only for LabVIEW 8.5 and newer?

 

Thanks for your great work.

 

Regards

Marc

CLD
Active Participant
Jack_A.
Posts: 245
0 Kudos

Re: Simple TCP Messaging (STM)

Hey Marc -

 

Thanks for the feedback....I've already implemented your recommendations into the next build of STM.  It should be on the web soon.

 

Yes, STM 2.0 will only be supported in LabVIEW 8.5 or later.  We will keep the current version of STM on the web if you need to use a previous version of LabVIEW. 

 

-Jack

Member
Marc Blumentritt
Posts: 121

Re: Simple TCP Messaging (STM)


Jack A. wrote:

Yes, STM 2.0 will only be supported in LabVIEW 8.5 or later.  We will keep the current version of STM on the web if you need to use a previous version of LabVIEW. 


OK, than I do have one more small patch (s. attachment).

 

Oh, and one more idea for you. I would recommend using LabVIEW classes for supporting different communication protocols like TCP, UDP or seriel. I think classes would be more flexible and could be easier extended to other communication methods. Well, just an idea.

 

Thanks for STM. While it is very simple, it is a powerful tool and I would have never thought about it doing communication this way.

 

Regards,

Marc

CLD