06-26-2015 01:56 PM
Hello everybod,
iam new in Network Programming with LabVIEW.
I have a data communication issue via TCP/IP protocol. I created a simple Client.vi that connect to QT-Server C++. if the connection established, Client.vi sent a simple string "Hello" to Qt-server.
the Problem is: Qt-Server recieves an empty string with the size 0!!!!
Client.vi
Qt-server
Qt-function recieve data:
Please help 🙂
Solved! Go to Solution.
06-26-2015 02:30 PM
My guess is you start your string with a "Type Cast" of the number 5. The first byte sent is a null, which tells C that it is the end of your string array.
Remove the whole type cast out of there and just send "hello". It likely will work.
06-26-2015 05:18 PM
thank you for your quick response.
the server receives the size of string but empty string
06-29-2015 05:34 AM
Well one possible problem you have is that you look for a size of qint16. I'm not familiar with QT nor the C++ syntax used within, but the LabVIEW length is an int32 and therefore 4 bytes. Also LabVIEW Typecast creates big endian stream data, meaning the string length will be MSB -> LSB ordered, making the first 3 bytes in the stream a 0 byte, causing your routine to determine that there are 0 bytes to read.
You have to read in 4 bytes for the length parameter, change the Byte Order to your local endianess, most likely having to swap the big endian number into little endian and then treat this as the number of bytes to read for the string.