LabWindows/CVI

取消
顯示結果 
搜尋替代 
您的意思是: 

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 積分
1 條訊息(共 3 條)
4,033 檢視

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 積分
2 條訊息(共 3 條)
4,023 檢視

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 積分
3 條訊息(共 3 條)
3,895 檢視