This is my first Winsock project.
I want to check if my connection the connected device (192.168.0.160) is alive.
So I made the following code:
Nothing fancyCode:Private Sub Form_Load() If Winsock1.State <> sckConnected Then Winsock1.RemoteHost = "192.168.0.160" Winsock1.RemotePort = "10055" Winsock1.Connect End If Timer1.Interval = 500 End Sub Private Sub Form_Unload(Cancel As Integer) Winsock1.Close End Sub Private Sub Timer1_Timer() Select Case Winsock1.State Case 6 Debug.Print "sckConnecting" Case 7 Debug.Print "sckConnected" End Select End Sub
But now the problem:
if my device is off and start my program, the winsock state is 6 ("sckConnecting") => no problem
Then I turn on my device and the winsock state changes to 7 ("sckConnected") => still no problem.
But if I then turn off my device (of disconnect the LAN connector) the winsock state will stay 7 ("sckConnected")
Why is it not changing back to 6 ("sckConnecting")??
Kiter





Reply With Quote