Components

cancel
Showing results for 
Search instead for 
Did you mean: 

Simple TCP Messaging (STM)

Here's a simple example of how to setup a server/client that will allow the client to disconnect and reconnect at will. Hope this may help.

authored by
Christian L, CLA
Systems Engineering Manager - Automotive and Transportation
NI - Austin, TX


  
0 Kudos
Message 101 of 174
(3,537 Views)

I'm using Labview 2013 + RT + fpga. Which version of the STM should I be using? Different samples / templates seem to use different versions and go into a compatability mode.The On-line documentation states that Version 2.1 is the latest but the JKI Package manager shows a 3.006  as the latest. I presently have 3.006 installed.

Thanks

0 Kudos
Message 102 of 174
(3,411 Views)

Hello, 

 

You should be using the version on the LabVIEW Tools Network (VIPM), that is, version 3.006. It is compatible with LV 2010 and newer. Please let me know if you have any problems with the templates with this version.

I'll update the STM Documentation to reflect the newest version. It may take a few days for our website to reflect these changes. 

 

Sincerely,

 

Julianne K
Systems Engineer, Embedded Systems
Certified LabVIEW Architect, Certified LabVIEW Embedded Systems Developer
National Instruments
0 Kudos
Message 103 of 174
(3,396 Views)

What would be the best way to modify and use this for a re-connectable STM  send and receive loops? Or is there a different approach for that ?

 

Thanks,

DennisR

0 Kudos
Message 104 of 174
(3,349 Views)

What I would like to see is the STM implemented using the Network Streams.  That would have the reconnecting setup already built in.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 105 of 174
(3,341 Views)

Well, the devil sits in the little details but in principle a reconnecting client library would in the first place implement some retry mechanisme whenever it sees an error during communication with the server. You would have to treat all TCP errors that the LabVIEW nodes return, except sometimes timeout depending on the protocol step you are in, as well as errors in you protocol layer handling when receiving illegitimate data packets as an indication to close the connection and then reopen it. This generally requires a more involved setup as each connection also needs to somehow allow to retrieve the actual address (and port) information in order to be able to reconnect.

 

On the server side the handling is a little simpler. Whenever you see an error (except timeout errors when waiting for commands from the client) you simply close the connection. This will cause the client to receive a "connection closed by peer" error and then to attempt a reconnection with the server.

Rolf Kalbermatter
My Blog
0 Kudos
Message 106 of 174
(3,332 Views)

Hi,

 

I would like to communicate with a cRIO using this library, but from a C# program.

Is there any librrary or a .NET based example of a STM client?

 

Regards,

Pedro

0 Kudos
Message 107 of 174
(3,282 Views)

Hi Pedro, 

 

There is a MSVC++ Example using STM, found here. I also wrote an example for Visual Basic .NET, which is not 100% complete but may act as a good starting point. It is attached. 

Julianne K
Systems Engineer, Embedded Systems
Certified LabVIEW Architect, Certified LabVIEW Embedded Systems Developer
National Instruments
Message 108 of 174
(3,268 Views)

Thanks Julianne, that is very helpfull!

 

Is there any plan to include a password authentication in future releases of STM library?

 

Regards,

Pedro

ENDIPREV Lda
0 Kudos
Message 109 of 174
(3,260 Views)

Hello, 

 

There are currently no plans to add it. However, I have added your request to the feature request list for STM so that it can be considered for the future. 

Julianne K
Systems Engineer, Embedded Systems
Certified LabVIEW Architect, Certified LabVIEW Embedded Systems Developer
National Instruments
0 Kudos
Message 110 of 174
(3,255 Views)