Also, it looks like this stream loop is not active all the time. Should this loop be running the entire time that it is connected? Or should this close at some point? Is this a good way to do it?
vb Code:
''' <summary> ''' Watches a stream while a user is connected? Stays alive while user is connected? ''' </summary> Private Sub streamWatcher(ByVal objStream As Object) Try Dim curStream As NetworkStream = CType(objStream, NetworkStream) Do Until Disposing = True Or curStream Is Nothing If curStream.DataAvailable Then Dim message As String = receiveText(curStream) RaiseEvent DataArrival(Me, message) End If Threading.Thread.Sleep(10) Loop Catch End Try End Sub




Reply With Quote