Client.Disconnect Method

Removes the specified client.

Syntax

NSUnicastMgr.Client.Disconnect

Return Values

Returns an ActiveX HRESULT error code.

Example

The following example shows how to disconnect clients that are not in a particular IP subnet. It disconnects all the clients that are not on a particular class C subnet (where the first three octets in the address are set, such as: 123.4.140.xxx).

Sub OutsidersBeGone( subnet )
   For i = 0 to NSUnicastMgr.Clients.Count
      TheClient = NSUnicastMgr.Clients( i )
      ' check if the client is on the same subnet
      If StripSubnet( TheClient.IPAddress ) <> StripSubnet(subnet)) Then
      ' client is on another subnet. Show a descriptive
      ' message about the client
          MsgBox "Client Disconnected:"             & vbCrLf & _
                 "ClientID: " & TheClient.ClientID  & vbCrLf & _
                 "Address:  " & TheClient.IPAddress & vbCrLf &_
                 "Port:     " & TheClient.PortID
          TheClient.Disconnect
      End If
   Next
End Sub

Function StripSubnet( ip )
' strips the last octet off an IP address
   StripSubnet = Left( ip, ( InstrRev(ip,".", -1, 1 )) - 1 )
End Function
© 1996-1998 Microsoft Corporation. All rights reserved.