Hey sorry I missed this. I think I filed my code in the round filing bin by mistake a few years ago. I've starting re-writing some of the verrrry verrry basic bits.
Key parts are: Bare Visual Studio Community is all you need. No drivers, dump all that NI/VISA bloat, at least for what I'm doing, LXI can do it all. Good frame rates too. See other threads in this forum for some Python scripts I think.
Kinda like this in VB.NET (but can put together better code if you want):
rem init
dim _client = New TcpClient(address, port)
_stream = _client.GetStream()
rem sub for sending a command
Public Sub Execute(message As [String])
Try
If _client.Connected = False Then
Stop
_client.Connect(_address, _port)
Threading.Thread.Sleep(100)
End If
Dim sendBuffer = System.Text.Encoding.ASCII.GetBytes(message & Lf)
_stream.Write(sendBuffer, 0, sendBuffer.Length)
Catch e As ArgumentNullException
Console.WriteLine("ArgumentNullException: {0}", e)
Catch e As SocketException
End Try
End Sub
rem function for reading:
Public Function QueryText(message As [String]) As String 'Implements ISCPIDevice.QueryText
Dim data As New List(Of Byte)
Try
If _client.Connected = False Then
'Stop
_client.Connect(_address, _port)
Threading.Thread.Sleep(100)
End If
Dim sendBuffer = System.Text.Encoding.ASCII.GetBytes(message & Lf)
'Dim stream = _client.GetStream()
_stream.Write(sendBuffer, 0, sendBuffer.Length)
Dim receiveBuffer = New [Byte](16384) {}
Do Until _stream.DataAvailable
Threading.Thread.Sleep(1)
Loop
Dim lfFound = False
Do
Dim byteCount = _stream.Read(receiveBuffer, 0, receiveBuffer.Length)
Dim bytes = receiveBuffer.Take(byteCount)
data.AddRange(bytes)
If bytes.Contains(10) Then
lfFound = True
End If
Loop Until lfFound
' _stream.Dispose()
Catch e As ArgumentNullException
Console.WriteLine("ArgumentNullException: {0}", e)
Catch e As SocketException
End Try
Dim result = System.Text.Encoding.ASCII.GetString(data.ToArray())
Return result
End Function