03-04-2014 03:34 PM
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
03-05-2014 01:03 AM
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,