The TCP_READY is an indication that there is some data available to be read. TCP works as a byte stream, so dataready does not actually tell you how much data is being made available, it just tells you there is something there that should be read.
For example, if on the server side, you do 2 tcp write operations, the client will see the data and will fire tcp dataready. The dataready callback will not fire only 2 times though. It will keep on firing if there is any data available on the port.
So if the server writes 40 bytes in the first write operation and 10 in the other, there is no guarantee that the first time dataready fires on the client, all 40 bytes will be available to read. ( TCP optimizes data buffer sizes to make sure you don�t slo
w down networks with many small packets if one big packet can do the job). You will need to keep on reading the tcp port from the first callback until all the data you expected is returned. So if you are streaming data (sending arrays for example), you are responsible to re-creating the byte stream on the client side. If the case of arrays, you might send some header info that would tell you the size of the array coming so you can completely read it correctly.
Since this does take 5 seconds, you might check out some of the threading examples under ..CVI\samples\utility\Threading. You can do the grunt work in a worker thread so the UI doesn�t look like its unresponsive to the user.
I hope this explains things.
Bilal
Bilal Durrani
NI