Hi all,

I tried to write a winsock application, but I cannot understand something:

VB Code:
  1. Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
  2.  
  3. Private Sub Form_Load()
  4.  Winsock1.Connect "127.0.0.1", 445
  5.  Sleep 1000
  6.  MsgBox Winsock1.State
  7. End Sub

If I run this code, the state is always 6, and not depends on sleep value.
But, if I add another msgbox, before the state, the state will be correct - 7:

VB Code:
  1. Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
  2.  
  3. Private Sub Form_Load()
  4.  Winsock1.Connect "127.0.0.1", 445
  5.  Sleep 200
  6.  MsgBox ".."
  7.  MsgBox Winsock1.State
  8. End Sub

Why shows the current state only, when I add another msgbox before it???

Thanks.