LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

TCP Header Little Endian vs Big Endian

Solved!
Go to solution

Hello,

 

I have a TCP communication problem with a host.
I can easily connect to the host which tells me it is a Little Endian (int HostIsLittleEndian (void);).
The problem is that the client specification asks me for the telegram size to be in Big Endian.
Can anyone help me solve this problem?

 

MattiaG_0-1717503783905.png

 

0 Kudos
Message 1 of 3
(325 Views)
Solution
Accepted by topic author Mattia.G

I may guess that what you are to accomodate is not the header of the raw TCP message, which is a lot more complex and is automatically handled by the OS, but rather the data field of the message itself, into which you must incapsulate that value as part of the device specific protocol. If this is true, then you can use an appropriate ToXXXEndian () CVI function to accomodate the header in the format required from the host you are communicating with.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
Message 2 of 3
(270 Views)

Ciao Roberto,

 

Thank you for the suggestion. You're right, I just need to add the big endian length into the buffer that is sent.

I was getting lost in a glass of water.

 

Grazie per il lavoro che fai su questo forum.

 

Ciao

Mattia

0 Kudos
Message 3 of 3
(265 Views)