LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

ServerTCPRead always takes ~500ms to read with timeout set to 1000

It always takes between 513 - 525 milliseconds to read a message, regardless if the message data has 32 bytes or 4K bytes. 

Here is the call:

 

   readSize = ServerTCPRead(handle, (char *)&msgBuf[0], 4096, 1000);

 

Is there a safe way to fix this issue?  My downloads are taking forever because of the read times. 

 

Could I safely reduce the timeout time to get better performance?

 

FYI the data writes work fine - only take 12 - 30 milliseconds:

   bytesOut = ServerTCPWrite (handle, &msg, (lwMsgSize*4), 1000);

0 Kudos
Message 1 of 3
(3,491 Views)

Actually I had a bug in my code. The read delay is more like 75-100 milliseconds.

That is still a lot when reading a response, which is required before sending the next download message

0 Kudos
Message 2 of 3
(3,481 Views)

Hello Butch01                     

 

Try call the read func twice

in the first call with max size = 0 than the func will return the byte count ready in the buffer

in the second call it with the size returned in the 1st call

 

0 Kudos
Message 3 of 3
(3,353 Views)