State

This property returns the state of the control as expressed by an enumerated list. This is read-only property and is unavailable at design time.

Syntax: nValue = oSocket.State

nValue        (Long) the number assigned to the different socket states
0 = sckClosed
1 = sckOpen
2 = sckListening
3 = sckConnectionPending
4 = sckResolvingHost
5 = sckHostResolved
6 = sckConnecting
7 = sckConnected
8 = sckClosing
9 = sckError

Group :  Socket Object

Example:

Dim WithEvents oSocket As Socket ' module level Dim

Private Sub oSocket_OnConnect()

  On Error Resume Next

  '

  Set oSocket = New Socket

  If oSocket.State <> sckConnected Then

     App.MsgBox("Connect failed.")

End Sub