01-18-2011 07:58 AM
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.
Solved! Go to Solution.
01-18-2011 08:43 AM
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.
01-18-2011 08:55 AM
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.
01-18-2011 09:00 AM
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.
01-18-2011 09:03 AM
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.
01-18-2011 10:02 AM
guys i used concatenating strings but i dont get how to seperate them in the client.
01-18-2011 10:16 AM - edited 01-18-2011 10:16 AM
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.
01-18-2011 10:25 AM
thats the part i dont get,in the other side what function do i use to split the commas?
01-18-2011 10:30 AM - edited 01-18-2011 10:31 AM
This is the technique I use.
01-18-2011 10:50 AM
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.