10-11-2010 03:33 PM
Thank you in advance for any help; I am new to this. A group created an application in LabView for transfering real time data using DataSocket Server 4.5. I am looking to interface with their application (compiled into an EXE) with VB.Net to use the data further. When I use the following code to access dstp://127.0.0.1:3105/score_data/current_round which is a number, everything works fine, I get the number back. When I try to access dstp://127.0.0.1:3105/score_data/schedule_scores, I get the following error. I believe schedule_scores is a variant (again new to this so I could be wrong) but the error occurs as soon as it tries to read the data even before it reaches "Dim r = ...". I have attached a screen shot of the DataSocket Server Diagnostics screen.
I have dropped a DataSocket control onto the WinForm from the toolbar.
My Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
DataSocket1.Connect("dstp://127.0.0.1:3015/my_data/schedule_scores", AccessMode.Read)
End Sub
Private Sub DataSocket1_DataUpdated(ByVal sender As System.Object, ByVal e As NationalInstruments.Net.DataUpdatedEventArgs) Handles DataSocket1.DataUpdated
Try
Dim r = e.Data.Value
Catch ex As Exception
TextBox1.Text = ex.ToString
End Try
End Sub
Private Sub DataSocket1_StatusUpdated(ByVal sender As System.Object, ByVal e As NationalInstruments.Net.ConnectionStatusUpdatedEventArgs) Handles _
DataSocket1.ConnectionStatusUpdated
ListBox2.Items.Add(e.Status.ToString)
End Sub
Private Sub button_disconnect_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button_disconnect.Click
DataSocket1.Disconnect()
End Sub
Error:
System.Runtime.InteropServices.SEHException: External component has thrown an exception.
at System.RuntimeType.ForwardCallToInvokeMember(String memberName, BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData& msgData)
at NationalInstruments.Net.Internal.Win32.IAxDataSocketData.get_Value()
at NationalInstruments.Net.DataSocketData.a.a()
at NationalInstruments.Net.DataSocketData.get_Value()
at DSTesting.Form1.DataSocket1_DataUpdated(Object sender, DataUpdatedEventArgs e) in C:\Users\scauthen\Documents\Visual Studio 2008\Projects\DSTesting\DSTesting\Form1.vb:line 9
Any help or direction someone can provide would be greatly appreciated.
Stephen