LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Using TCP function to send/receive message (cvi 6)

I use ClientTCPWrite()to send a string to the TCP server, use ServerTCPRead() to receive the string ,then compare the received string with a konwing string , is there a fast way to complete the work ? Because the received string always follows an unknown character .

David
0 Kudos
Message 1 of 3
(3,237 Views)
David...

If you 'always' rx've an unknown char, can you not offset your search by one char and start looking after it

or

Search within the rx'ed string for your target string, if its not there it would return -1, if there it would return the starting position of your target string.

or

Check that in your string you are sending to you TCP server that you are not sending somethng you shouldn't. Are you creating the string at string[1] and forgetting string [0]. Or have you got some '\' within your string that are being interpretted as a control code and treat the next character wrongly?

Just a few things off the top of my head.

Regards

Chris
Message 2 of 3
(3,237 Views)
David,

Included in the toolslib there is an instrument driver that can help you match the known string. You can loaded at:

C:\Program Files\National Instruments\CVI70\toolslib\toolbox\regexpr.fp

It has some functions that should allow you to search for the known string and then read the unknown character once you know the offset.

I hope this helps.

Regards,

Juan Carlos
N.I.
0 Kudos
Message 3 of 3
(3,237 Views)