This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.
Private _tcpClient As TcpClient Public Event NewSocketData(ByVal data As String) Private Sub DoRead(ByVal ar As IAsyncResult) Dim bytesRead As Integer Dim message As String Try '// Finish asynchronous read into readBuffer and return number of bytes read. bytesRead = Me._tcpClient.GetStream.EndRead(ar) If bytesRead < 1 Then ' If no bytes were read server has closed. Me._socketdata.Add("Connection was terminated") RaiseEvent NewSocketData("Connection was terminated") Exit Sub End If '// Convert the byte array the message was saved into, minus two for the '// Chr(13) and Chr(10) message = Encoding.ASCII.GetString(Me._readBuffer, 0, bytesRead - 2) ProcessCommands(message) Catch ex As Exception MessageBox.Show(ex.StackTrace.ToString) End Try 'Need help here.. this does not work RaiseEvent NewSocketData("test") '// Start a new asynchronous read into readBuffer. Me._tcpClient.GetStream.BeginRead(Me._readBuffer, 0, READ_BUFFER_SIZE, AddressOf DoRead, Nothing) End Sub