Error processing SSI file
LEADTOOLS Multimedia (Leadtools.MediaStreaming assembly)

Show in webframe

Connections Property






Retrieves the number of active connections the client currently has.
Syntax
public int Connections {get;}
'Declaration
 
Public ReadOnly Property Connections As Integer
'Usage
 
Dim instance As Client
Dim value As Integer
 
value = instance.Connections
public:
property int Connections {
   int get();
}

Property Value

An integer value representing the number of active connections.
Remarks

A client will be deleted if it has not had any active connections for 60 seconds.

If the method fails, an error is raised. For more information, refer to the Error Codes.

Example
Copy Code  
Imports Leadtools
Imports Leadtools.MediaStreaming

Public _server As Server = Nothing
Public _result As Boolean = False

Public Sub PrintClientsExample()
  Try
     Dim Count As Integer = 0
     Dim strClients As String = ""

     ' create an instance of the server object
     _server = New Leadtools.MediaStreaming.Server()


     ' edit network properties, application properties, MIME types, or IP filters here

     ' start the server
     _server.Start()

     ' make sure that there is some clients connected to the server.

     ' retrieve a copy of the Application Properties
     Dim clients As Clients = _server.GetClients()

     'Get the Application Properties count
     Count = clients.Count

     ' print the clients items to a string

     strClients &= String.Format("--- Clients (count = {0}) ---" & Constants.vbLf + Constants.vbLf, Count.ToString())

     Dim nIndex As Integer = 0
     For Each client As Client In clients
       Dim ip As String
       Dim connections As Integer
       Dim connectiontime As Double

       ' get IP Address
       ip = client.IPAddress

       ' get number of connections
       connections = client.Connections

       ' get connection time
       connectiontime = client.ConnectionTime

       ' convert to local time
       Dim dt As DateTime = DateTime.FromOADate(connectiontime)
       Dim dtLocal As DateTime = dt.ToLocalTime()
       Dim sconnectiontime As String = dtLocal.ToString("yyyy-MM-dd HH:mm:ss")

       strClients &= String.Format("Client[{0}]: {1}, connections = {2}, connection time = {3}" & Constants.vbLf, nIndex.ToString(), ip, connections.ToString(), sconnectiontime)

       nIndex += 1
     Next client

     ' display a message contains the clients information string
     MessageBox.Show(strClients, "LEADTOOLS Media Streaming Examples", MessageBoxButtons.OK, MessageBoxIcon.Information)

     _result = True
  Catch e1 As Exception
     _result = False
  End Try
End Sub
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, application properties, MIME types, or IP filters here

      // start the server
      _server.Start();

      // make sure that there is some clients connected to the server.

      // retrieve a copy of the Application Properties
      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

Client Class
Client Members

Error processing SSI file
Leadtools.MediaStreaming requires a Multimedia or Multimedia Suite license and unlock key. For more information, refer to: LEADTOOLS Toolkit Features