LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

TCP connection does not work as EXE

Solved!
Go to solution

@Ravishankar.nk wrote:

Pls change the RT application as TCP listen and GUI(Host) as TCP Open.

 

U didn't give the code. but i attached the basic module.

 

try it


This really doesn't matter. You can have either one be the client or server, it makes no fundemental difference. Also, ravishankars suggestion does not manager the header properly, or in a flexible way, by hardcoding a constant 4 bytes as the header. You should have a header cluster and use a type cast of the cluster to string and then get string length to determine the number of bytes to read from the TCP connection. This way if your cluster changes, you don't have to update a constant in your code. I'll draw up an example.

0 Kudos
Message 21 of 23
(1,198 Views)
Solution
Accepted by topic author CarmineS

I know this is a little OT but here's how I typically manage sending/receiving of data. I want to make sure you develop good habits Smiley Wink Your clusters should be typedefs, I just didn't bother to convert them for this example. Note, this does not show how to manage open close connections, errors etc. But it shows how to transfer data in a flexible way. You never have to touch your TCP/IP communication now, just change the clusters and everything will update accordingly because you are getting the data size programmatically rather than using constants. Let me know if you have questions or don't see why this is flexible. Any even more flexible would be if you have different types of data you may send, in the action you say which type of data is being sent and then you can unflatten from string accordingly.

 

 

 

Message 22 of 23
(1,194 Views)

sure, it will reestablish.

0 Kudos
Message 23 of 23
(1,169 Views)