LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 
Reply

TCP TRANSFER DATA

Solved!
Go to solution

Hello,

 

I want to know how I can tranfer various data through TCP protocol.

 

In the picture, I tranfer target to host the add of two number, imagine that I want to do the rest of theese number and tranfer the solution, how can i do? 

 

Have i established a new communication? One communication for each data? or is there any way to tranfer multiple data in one communication?

 

 

Thanks so much.

 

 

0 Kudos
Message 1 of 18
(732 Views)

Hi Cristina,

 

you can put into the message whatever you like: either just one number or a whole array of numbers. It's up to you!

 

You should read about efficient data structures: creating some kind of "structure" in your data will help you with each communication…

Best regards,
GerdW
CLAD expired, using 2009SP1 + LV2011SP1 + LV2017 (+LV2018 sometimes) on Win7+cRIO
Kudos are welcome Smiley Wink

0 Kudos
Message 2 of 18
(721 Views)
Solution
Accepted by topic author cristina.lopez
01-08-2018 12:06 AM

Hi Cristina

 

We like to use the Flatten To String, at the sender end, and Unflatten From String, at the receiver end, to package and un-package string data.  You can flatten (and unflatten) multiple different data types into one string.  We like to use clusters (type defined) as they are good from a readability and scalability standpoint. e.g.

 

Flatten to String.png

 

 

Unflatten From String.png

 

We usually include a Destination (or similar) parameter in our data that allows the sender to define where, in the receiving application, the message should go and also gives us a convenient way to switch when the data arrives. e.g.

 

Unflatten From String Detination.png

 

Hope this helps

 

Steve

Combined.png

0 Kudos
Message 3 of 18
(704 Views)

I generally include a very basic header to all of my messages. It makes communication much more versatile as well as expandable. The most basic message header would include two pieces of information. The first piece is a message ID. This indicates the type of message being sent. This allows the other side to take the appropriate action when it receives the message as well as know how to decide it. The second piece I include is length of the message data. I generally use integers for each value. This way the receiver reads a fixed number of bytes, 8 if both are 32-bit values. The first lets the receiver know what type of message is being received and the send will let it know how much more data needs to be read. This is a very efficient method. It also makes it very easy to add new messages as the application grows.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 4 of 18
(693 Views)

@Mark_Yedinak wrote:

I generally include a very basic header to all of my messages. It makes communication much more versatile as well as expandable. The most basic message header would include two pieces of information. The first piece is a message ID. This indicates the type of message being sent. This allows the other side to take the appropriate action when it receives the message as well as know how to decide it. The second piece I include is length of the message data. I generally use integers for each value. This way the receiver reads a fixed number of bytes, 8 if both are 32-bit values. The first lets the receiver know what type of message is being received and the send will let it know how much more data needs to be read. This is a very efficient method. It also makes it very easy to add new messages as the application grows.


I just use the STM library and that takes care of all of that for me.

 

As far as the actual data, I am a HUGE fan of the Flatten To String and Unflatten From String.  What makes these functions better is you can specify the byte order, which can matter a lot depending on what you are communicating with.


There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
0 Kudos
Message 5 of 18
(680 Views)

@crossrulz wrote:

@Mark_Yedinak wrote:

I generally include a very basic header to all of my messages. It makes communication much more versatile as well as expandable. The most basic message header would include two pieces of information. The first piece is a message ID. This indicates the type of message being sent. This allows the other side to take the appropriate action when it receives the message as well as know how to decide it. The second piece I include is length of the message data. I generally use integers for each value. This way the receiver reads a fixed number of bytes, 8 if both are 32-bit values. The first lets the receiver know what type of message is being received and the send will let it know how much more data needs to be read. This is a very efficient method. It also makes it very easy to add new messages as the application grows.


I just use the STM library and that takes care of all of that for me.

 

As far as the actual data, I am a HUGE fan of the Flatten To String and Unflatten From String.  What makes these functions better is you can specify the byte order, which can matter a lot depending on what you are communicating with.


I have to maintain the ability to communicate with components written in other languages so I try to keep a very language agnostic approach.

 

I am also a big fan of flatten/unflatten as well. While variants are very useful internally when working with other languages they are not workable at all.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 6 of 18
(674 Views)

Thanks so much, I got my goal with your solution.

 

 

0 Kudos
Message 7 of 18
(651 Views)

Sorry, another question.

 

If i want to tranfer a control, how can i do this? because , I'm trying to do this with the solution that you gave me, but it's not valid to transfer control.

 

Thanks.

0 Kudos
Message 8 of 18
(636 Views)

What properties (value, Label text, Description text etc.) of your control do you want to transfer?

 

 

Combined.png

0 Kudos
Message 9 of 18
(631 Views)

I want transfer de value of my controls, almost all my controls are dbl type, except 2 that they are u8 type.

 

Thanks. 

0 Kudos
Message 10 of 18
(627 Views)