LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

ServerTCPWrite

lets say i have

int x[50];

char str[20];

on both server and client computre

 

how can i use ServerTCPWrite, one time to send x and one time to send str?

if i use in the server:

ServerTCPWrite (ClientHandle, x, 50, 0); 

ServerTCPWrite (ClientHandle,str, 20, 0);  

 

and in the client:

case TCP_DATAREADY:  

ClientTCPRead (handle, x, 50, 0);

 

it will only read the x int

help

thanks

0 Kudos
Message 1 of 2
(3,688 Views)

Hi,

 

First of all, I think the line:

ServerTCPWrite (ClientHandle, x, 50, 0);

does not serve your purpose. x is an integer array of 50 elements, but its total size is not 50 bytes. 

Your code above writes only 50 bytes from the array which is not 50 integers.

If you want to send the whole array you should write:

ServerTCPWrite (ClientHandle, x, sizeof(x), 0);

 

About the missing data on the client side; can you please try the example code in the link below.

http://zone.ni.com/reference/en-XX/help/370051V-01/cvi/libref/cviclienttcpread/

 

This method is also referred in the function help text of ClientTCPRead in CVI.

Let us know if it works.

 

Regards,

S. Eren BALCI
IMESTEK
0 Kudos
Message 2 of 2
(3,664 Views)