ConnectionTime Property

Summary
Retrieves the last time the client established a connection.
Syntax
C#
VB
C++
public double ConnectionTime { get; } 
Public ReadOnly Property ConnectionTime As Double 
public: 
property double ConnectionTime { 
   double get(); 
} 

Property Value

A double value representing the last time the client established a connection.

Remarks

This double value represents an OLE Automation DateTime, where the integral component is the number of days before or after midnight, 30 December 1899, and the fractional component represents the time on that day divided by 24.

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

Example
C#
VB
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; 
   } 
} 
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 
Requirements

Target Platforms

See Also

Reference

Client Class

Client Members

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

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