IPAddress Property (Client)

Summary
Retrieves the IP address of the client.
Syntax
C#
C++/CLI
public string IPAddress { get; } 
public: 
property String^ IPAddress { 
   String^ get(); 
} 

Property Value

A string value representing the client's IP address.

Remarks

This function will return the string containing the IP address of the client.

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

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

Client Class

Client 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.