MAP SCPI query timeout during read over VISA SOCKET connection

Knowledge Base - Solution

When connected to MAP using VISA SOCKET and sending SCPI queries, the read times out. A VISA timeout error will be returned, and below are a couple of examples. -> 0xBFFF0015 (VI_ERROR_TMO) Timeout expired before operation completed. -> VI_ERROR_TMO (-1073807339): Timeout expired before operation completed.
First, ensure no delay has been inserted between writing the SCPI query command, and reading the response. For a query, the read should be performed immediately after the write. Second, when using a VISA TCPIP instrument (INSTR) resource string for connection to MAP, that protocol implementation has a native mechanism to specify the end of a message. However, when using VISA TCPIP SOCKET resource string, you need to tell VISA how messages are terminated. Otherwise, VISA times out on the query (read) because it is doesn’t know where is the end of message and waits to read more bytes. All messages from MAP are terminated with a newline/linefeed character (0x0A = '\n'). The VISA termination character enable property should be set to true and the termination character set to 0x0A. VISA will then be able to detect the end of message and not timeout.