address
String containing the IP address of the client to disconnect.
blacklist
Boolean value that indicates whether the client should be black-listed from future connections; true to Black-list the client. false to not black-list the client.
If the method fails, an error is raised. For more information, refer to the Error Codes.
using Leadtools;
using Leadtools.MediaStreaming;
public Server _server = null;
public bool _result = false;
public void BlacklistClientExample()
{
try
{
int Count = 0;
string strClients = "";
// create an instance of the server object
_server = new Leadtools.MediaStreaming.Server();
// edit network properties
NetworkProperties netProps = _server.GetNetworkProperties();
string HttpUrl = "http://" + netProps.ActualIPAddress + ":" + netProps.Port + "/DaDa_H264.mp4";
netProps.MediaFolder = @"C:\LEADTOOLS22\Resources\Media";
_server.SetNetworkProperties(netProps);
// start the server
_server.Start();
// make sure that there is some clients connected to the server.
System.Diagnostics.Process.Start(HttpUrl);
MessageBox.Show("Attempting to playback stream in default browser using: " + HttpUrl
+ "\n Press OK button AFTER video starts playing");
// this demo will disconnect the first client in the clients list,
// and mark it as black list connection.
// retrieve collection of clients
Clients clients = _server.GetClients();
//Get the Application Properties count
Count = clients.Count;
if (Count > 0)
{
Client cl = clients[0];
// disconnect and black-list the client
_server.Disconnect(cl.IPAddress, true);
// make sure it has now zero active connections.
if (cl.Connections == 0)
{
_result = true;
return;
}
}
_result = false;
}
catch (Exception)
{
_result = false;
}
}