LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

TCP/IP + receiving empty string

Hello,

 

I have a client application which reads several string of different length sent by the server. I have a String combo-box which displays the strings sent. The Server sends string such as: 6Hello1, 6Hello2, 6Hello3 (6 is length of the string)etc.
1. At the client side, once I receive the Hello1, I then get an empty string "" followed by Hello2 and then again an empty string "" followed by Hello3 and so on. I do not understand why am I receiveing an empty string each time.

2. Also, my String combo-box Indicator on the front pannel does not show the list of the strings received. When Hello1 is received it is displayed on the String combo-box, which then disappears(my guess is because a "" is received) and then Hello2 is received which is seen on the String combo-box which again disappears and so on. I am not able to see all the received string in the Combobox.

 

Regards,

 

-H

 

 

0 Kudos
Message 1 of 4
(3,835 Views)
One thing you could do is only read data if the length is greater than 1. As written, if you timeout for a read for you initial read of the length than you will read 0 bytes, which by itself is not a problem however it will return an empty string. You then update your display with the empty string. Modify your code to only read if there is actually data available (length > 0) and only update your display if you read something.


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 2 of 4
(3,818 Views)

by chance is your sending side sending a terminator character too (like LF or CRLF or such)?  These could have been introduced when creating your outgoing strings depending on how you did it.

Without seeing the sending side I cannot be sure.    When viewing the outgoing string, set the string display for / displays, this way you can see any non-printing characters.  You can use the trimwhitespace function in the string pallette to get ridof them depending on what they are.trimWhitespace.jpg

 


Paul
0 Kudos
Message 3 of 4
(3,815 Views)

re #2:

 

it sounds like you are updating the value of the combobox with each new string.

 

a combobox has a string-type value and an array of strings which are items for the ring/enum behavior of the combobox. When you update the value, you just overwrite the last value you assigned to the control.  These aren't beinng aded to the list of options.

 

you need to access the properties of the control with a property node and add each string to the array.

 

cbox_props.png

Message Edited by blawson on 11-23-2009 04:06 PM
-Barrett
CLD
Message 4 of 4
(3,791 Views)