public double ConnectionTime { get; }
A double value representing the last time the client established a connection.
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.
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;
}
}