держи
Private Sub Timer1_Timer()
Select Case ws.State
Case 0
Label1.Caption = "closed"
ws.Connect
Case 1
Label1.Caption = "Open"
Case 2
Label1.Caption = "Listening"
Case 3
Label1.Caption = "Connection pending"
Case 4
Label1.Caption = "Resolving host"
Case 5
Label1.Caption = "Host resolved"
Case 6
Label1.Caption = "Connecting"
Case 7
Label1.Caption = "connected to " & ws.RemoteHostIP & " (" & ws.RemoteHost & ")"
'ваши действия
Case 8
Label1.Caption = "disconnected (server out)"
Case 9
Label1.Caption = "Error"
ws.Close
End Select
End Sub
немного лишнего, но я думаю не помешает