Previous | Next |
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 subnetwork. It disconnects all the clients that are not on a particular class C subnetwork (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 - 1
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( IPAddress, ( InstrRev(IPAddress,".", -1, 1 )) - 1 )
End Function
Previous | Next |