Home > Language Reference > Classes > StreamBluetooth

Disconnected Event

Event raised when the socket is closed by the remote device.

Syntax

Public Event Disconnected()

Remarks

The Disconnected event is raised when an open socket is closed, either because the radio becomes out of range, or either because the remote device shut down the connection by calling the Close method. This event is not raised if the socket is closed by the local device.

You typically use this event to update the internal state of your application, as in the following example:

Private sClient As StreamBluetooth

Private Sub cmdConnect_Click()
  If sClient Is Nothing Then
    ' Code that performs the connection omitted for clarity
    cmdConnect.Text="Disconnect"
  Else
    sClient_Disconnected
  End If
End Sub

Private Sub sClient_Disconnected()
  sClient.Close
  Set sClient=Nothing
  cmdConnect.Text="Connect"
End Sub

Note that this event can only be raised by a StreamBluetooth object behaving as a client, ie returned by the ConnectedInbound event or initialized by a call to the RfCommConnect or the L2CapConnect methods.

System requirements

SystemMinimal versionRemarks
Palm OSPalm OS 5.0Requires a Bluetooth enabled device.