Seems like all the templates and examples have a Connection State Loop that looks like this:
Why? Why not simply react to the ScsServices.Client Disconnect Event Like this:
Must be a reason...but I can't figure it out! But from a programming cleanliness perspective, I do hate an endless loop with a yielding sleep function.
Thoughts?
Code:
Do Threading.Thread.Sleep(30) Loop While client.CommunicationState = HSCF.Communication.Scs.Communication.CommunicationStates.Connected _ And Not IsShuttingDown
Code:
Public WithEvents client As HSCF.Communication.ScsServices.Client.IScsServiceClient(Of IHSApplication) ... ... Private Sub Client_Disconnected(ByVal sender As Object, ByVal e As System.EventArgs) _ Handles client.Disconnected Disconnect() '// Run the Disconnect cleanup code RaiseEvent ConnectionMessages(eHS3ConnectionMessageType.Disconnected, "Disconnected from Server") End Sub
Thoughts?
Comment