LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

TCPiP communucation betwenn QT-server und Labview-Client

Solved!
Go to solution

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

client.PNG

 

 

Qt-server

 

 

Qt-function recieve data:

QT Function recieve data

 

 

Please help 🙂

 

 

0 Kudos
Message 1 of 4
(4,240 Views)

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.

0 Kudos
Message 2 of 4
(4,229 Views)

thank you for your quick response.

the server receives the size of string but empty string Smiley Sad

0 Kudos
Message 3 of 4
(4,189 Views)
Solution
Accepted by topic author nbnnnbn

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.

Rolf Kalbermatter
My Blog
0 Kudos
Message 4 of 4
(4,086 Views)