Reading HSM Response

Aug 12, 2010 at 2:39 PM

In the "Connecting and sending commands to the simulator" documentation gives the details to handle received messages however it doesn't state the exact code.

Private Sub thales_MessageArrived(ByVal sender As ThalesSim.Core.TCP.WorkerClient, ByRef b() As Byte, ByVal len As Integer) Handles thales.MessageArrived
''Code to handle the message from the simulator.
End Sub

Private Sub thales_Disconnected(ByVal sender As ThalesSim.Core.TCP.WorkerClient) Handles thales.Disconnected
''Code to handle a disconnect.
End Sub

I basically want to get the HSM response to a textbox what would be the code?

Coordinator
Aug 12, 2010 at 7:54 PM

The response is in the byte array parameter of the MessageArrived event. You can simply convert these to text, search for the response and copy that to a textbox.

Something like:  Dim s As String = System.Text.Encoding.Default.GetString(b, 0, len)

Aug 13, 2010 at 5:07 AM

Thank you this helps