index
The zero-based index of the item to get.
The Client item at the specified index.
Exceptions
Exception | Description |
---|---|
System.ArgumentOutOfRangeException |
This property provides the ability to access a specific item in the collection by using the following syntax: myCollection[index]
The C# language uses the this keyword to define the indexers instead of implementing the Item property. VB implements Item as a default property, which provides the same indexing functionality.
using Leadtools;
using Leadtools.MediaStreaming;
public Server _server = null;
public bool _result = false;
public void IndexContainsExample()
{
try
{
// 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");
// for instance, a client with (IP = 10.0.4.63) is connected to the server.
// change this for your active client's IP Address.
// retrieve collection of clients
Clients clients = _server.GetClients();
// get the client object of IP address "10.0.4.63"
// this is equal to:
// Client client = clients["10.0.4.63"];
int nIndex = clients.IndexOf("10.0.4.63");
Client client = null;
if (nIndex > -1)
// access the client via the collection indexer
client = clients[nIndex];
// check whether the collection contains this item
// (it should we just got it with IndexOf above)
if (clients.Contains(client))
{
// set the result to what we expect
_result = true;
}
else
{
_result = false;
}
}
catch (Exception)
{
_result = false;
}
}