Count Property (Clients)

Summary
Gets the number of the client items contained in the collection.
Syntax
C#
C++/CLI
public int Count { get; } 
public: 
property int Count { 
   int get(); 
} 

Property Value

The number of items contained in the collection.

Example
C#
using Leadtools; 
using Leadtools.MediaStreaming; 
 
 
 
public Server _server = null; 
public bool _result = false; 
 
public void PrintClientsExample() 
{ 
   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"); 
 
      // retrieve collection of clients 
      Clients clients = _server.GetClients(); 
 
      //Get the Application Properties count 
      Count = clients.Count; 
 
      // print the clients items to a string 
 
      strClients += string.Format("--- Clients (count = {0}) ---\n\n", Count.ToString()); 
 
      int nIndex = 0; 
      foreach (Client client in clients) 
      { 
         string ip; 
         int connections; 
         double connectiontime; 
 
         // get IP Address 
         ip = client.IPAddress; 
 
         // get number of connections 
         connections = client.Connections; 
 
         // get connection time 
         connectiontime = client.ConnectionTime; 
 
         // convert to local time 
         DateTime dt = DateTime.FromOADate(connectiontime); 
         DateTime dtLocal = dt.ToLocalTime(); 
         string sconnectiontime = dtLocal.ToString("yyyy-MM-dd HH:mm:ss"); 
 
         strClients += string.Format("Client[{0}]: {1}, connections = {2}, connection time = {3}\n", nIndex.ToString(), ip, connections.ToString(), sconnectiontime); 
 
         nIndex++; 
      } 
 
      // display a message contains the clients information string 
      MessageBox.Show(strClients, "LEADTOOLS Media Streaming Examples", MessageBoxButtons.OK, MessageBoxIcon.Information); 
 
      _result = true; 
   } 
   catch (Exception) 
   { 
      _result = false; 
   } 
} 
Requirements

Target Platforms

See Also

Reference

Clients Class

Clients Members

Help Version 23.0.2024.2.29
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2024 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.MediaStreaming Assembly
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.