LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

VISA socket read translates CR\LF to CR\NULLs

I have a IVI app which controls a serial based instrument. When I RW directly from my COM port, no problem reading the CRLF sequences. However, when I put a Ethernet to serial box in between and confiure MAX to use a TCPIP socket instead of a COM port, all CRLF sequences get tranlated into CR\NULL's.

What this means is that my string functions fail (ie:strstr()), as they only look as far as the 1st NULL. The read itself indicates that the buffer is much larger, and indeed the data is there, just embedded with NULLs.

As a workaround, I replaced every NULL within the buffer[len] - len being returned by the read() - with spaces, and all is well again.

Is there a configuration I should use instead to stop the translation by
sockets?

rjmiller
0 Kudos
Message 1 of 2
(2,905 Views)
RJ:

This does not sound like behavior I'd expect. We certainly don't have code in NI-VISA that does this explicitly.

Do you have a network sniffer application? There are many that are freely downloadable and could really help us here. If you are able to use it to capture the actual Ethernet traffic between your computer's IP address and the device's IP address, that will prove that it's not somehow the fault of the instrument or of the connection.

By the way, if you do manage to get such a sniffer capture file, and you attach it here, make sure to either export it as text or specify what program you used, since they usually have proprietary file formats.

Dan Mondrik
National Instruments
0 Kudos
Message 2 of 2
(2,905 Views)