LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to make an array of strings?

Solved!
Go to solution

Hi,

In my VI i need to send 3 or more strings from a server to a client over a TCP/IP connection. the problem is that when i press the send button i need all the strings to be sent together so i assume i need an array but unfortunately i dont know how to build the array. i have attached my example to this post.

i appreciate the help!

Rambaldi.

0 Kudos
Message 1 of 15
(3,825 Views)

Not sure what you are trying to do this for but use a Build Array function and then use Array to Spreadsheet String function. Use the Spreadsheet String to Array function on the other side to get the string array.

Adnan Zafar
Certified LabVIEW Architect
Coleman Technologies
0 Kudos
Message 2 of 15
(3,808 Views)

TCPIP expects thay you send the packet as a single string.  you should format this into a single string that the client can understand.  Use string formater or concatinate string.

I would sue something like string1,string2,string3 or <string1><string2><string3>.

Other oprions are to build a string array, fletten to string on client side unflatten and the use the array.

 

Either way if you plan on sending 1 packet you will need a single formatted string and the client must understand the format.

 

You gan even get fancy and use a format like xml so you can genericly process the strings at the client.

Paul Falkenstein
Coleman Technologies Inc.
CLA, CPI, AIA-Vision
Labview 4.0- 2013, RT, Vision, FPGA
0 Kudos
Message 3 of 15
(3,799 Views)

when i send them as one string to the client,how can i get the original strings back?

and the strings sizes are different each time.

0 Kudos
Message 4 of 15
(3,794 Views)

In my previous post I mentioned several methods for formatting the strings so seperate them at the client.

The exact method is very dependent on the contents of the string.  By far the easest method is to use a delimeter that is never in the string comma delimited, nonprintable character like tab.

Paul Falkenstein
Coleman Technologies Inc.
CLA, CPI, AIA-Vision
Labview 4.0- 2013, RT, Vision, FPGA
0 Kudos
Message 5 of 15
(3,790 Views)

guys i used concatenating strings but i dont get how to seperate them in the client.

0 Kudos
Message 6 of 15
(3,773 Views)

Did you read Falkpl's post?
Use a delimeter when you concatenate your strings.

 

For example if you have 3 strings:
abc

def

ghi

 

Concatenate them with some character between them such as a comma:
abc,def,ghi

 

Then on the other end you can simply split around the commas to retrieve the original strings.

Cory K
0 Kudos
Message 7 of 15
(3,764 Views)

thats the part i dont get,in the other side what function do i use to split the commas?

0 Kudos
Message 8 of 15
(3,755 Views)

This is the technique I use.

 

Capture.PNG

Capture.PNG

=====================
LabVIEW 2012


Message 9 of 15
(3,751 Views)

i used your method steve but i get this error:

Error 1103 occurred at Unflatten From XML in TCP_Client3.vi

The XML tag describing the type of data is not recognized.

0 Kudos
Message 10 of 15
(3,738 Views)