UserName Property (NetworkProperties)

Summary

Gets or sets the user name to be used to perform server authentication.

Syntax
C#
VB
C++
public string UserName { get; set; } 
Public Property UserName As String 
public: 
property String^ UserName { 
   String^ get(); 
   void set (    String^ ); 
} 

Property Value

A string representing the user name to be used to perform server authentication.

Remarks

The default value for pVal is "admin".

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 PrintNetworkPropertiesExample() 
{ 
   try 
   { 
      string strNetworkProperties = ""; 
 
      // create an instance of the server object 
      _server = new Leadtools.MediaStreaming.Server(); 
 
      // retrieve a copy of the Network Properties 
      NetworkProperties props = _server.GetNetworkProperties(); 
 
 
      // print the Network Properties to a string 
 
      strNetworkProperties += "--- Network Properties ---\n\n"; 
 
      strNetworkProperties += string.Format("IPAddress = {0}\n", props.IPAddress); 
 
      strNetworkProperties += string.Format("ActualIPAddress = {0}\n", props.ActualIPAddress); 
 
      strNetworkProperties += string.Format("Port = {0}\n", props.Port.ToString()); 
 
      strNetworkProperties += string.Format("RTPPort = {0}\n", props.RTPPort.ToString()); 
 
      if (props.OpenWindowsFirewall) 
         strNetworkProperties += "OpenWindowsFirewall = true\n"; 
      else 
         strNetworkProperties += "OpenWindowsFirewall = false\n"; 
 
      switch (props.Authentication) 
      { 
         case Authentication.Basic: 
            strNetworkProperties += "Authentication = Basic\n"; 
            break; 
         case Authentication.Digest: 
            strNetworkProperties += "Authentication = Digest\n"; 
            break; 
         default: 
            strNetworkProperties += "Authentication = None\n"; 
            break; 
      } 
 
      strNetworkProperties += string.Format("UserName = \"{0}\"\n", props.UserName); 
 
      strNetworkProperties += string.Format("Password = \"{0}\"\n", props.Password); 
 
      strNetworkProperties += string.Format("Realm = \"{0}\"\n", props.Realm); 
 
      strNetworkProperties += string.Format("IdleTimeOut = {0}\n", props.IdleTimeOut.ToString()); 
 
      strNetworkProperties += string.Format("RTCPTimeOut = {0}\n", props.RTCPTimeOut.ToString()); 
 
      strNetworkProperties += string.Format("ServerName = \"{0}\"\n", props.ServerName); 
 
      if (props.RTSPEnable) 
         strNetworkProperties += "RTSPEnable = true\n"; 
      else 
         strNetworkProperties += "RTSPEnable = false\n"; 
 
      if (props.RTMPEnable) 
         strNetworkProperties += "RTMPEnable = true\n"; 
      else 
         strNetworkProperties += "RTMPEnable = false\n"; 
 
      if (props.HDSEnable) 
         strNetworkProperties += "HDSEnable = true\n"; 
      else 
         strNetworkProperties += "HDSEnable = false\n"; 
 
      if (props.SSFEnable) 
         strNetworkProperties += "SSFEnable = true\n"; 
      else 
         strNetworkProperties += "SSFEnable = false\n"; 
 
      if (props.DASHEnable) 
         strNetworkProperties += "DASHEnable = true\n"; 
      else 
         strNetworkProperties += "DASHEnable = false\n"; 
 
      strNetworkProperties += string.Format("MediaFolder = \"{0}\"\n", props.MediaFolder); 
 
      strNetworkProperties += string.Format("ResolvedMediaFolder = \"{0}\"\n", props.ResolvedMediaFolder); 
 
      strNetworkProperties += string.Format("SSLPort = \"{0}\"\n", props.SSLPort.ToString()); 
 
      byte[] hash = (byte[])props.SSLCertificateHash; 
      string strhash = ""; 
      if (hash.Length == 0) 
         strhash = "<empty>"; 
 
      for (int n = 0; n < hash.Length; n++) 
      { 
         strhash += hash[n].ToString(); 
      } 
 
      strNetworkProperties += string.Format("SSLCertificateHash = \"{0}\"\n", strhash); 
 
      strNetworkProperties += string.Format("SSLCertificateStore = \"{0}\"\n", props.SSLCertificateStore); 
 
      // display a message contains the Network Properties string 
      MessageBox.Show(strNetworkProperties, "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 PrintNetworkPropertiesExample() 
   Try 
      Dim strNetworkProperties As String = "" 
 
      ' create an instance of the server object 
      _server = New Leadtools.MediaStreaming.Server() 
 
      ' retrieve a copy of the Network Properties 
      Dim props As NetworkProperties = _server.GetNetworkProperties() 
 
 
      ' print the Network Properties to a string 
 
      strNetworkProperties &= "--- Network Properties ---" & Constants.vbLf + Constants.vbLf 
 
      strNetworkProperties &= String.Format("IPAddress = {0}" & Constants.vbLf, props.IPAddress) 
 
      strNetworkProperties &= String.Format("ActualIPAddress = {0}" & Constants.vbLf, props.ActualIPAddress) 
 
      strNetworkProperties &= String.Format("Port = {0}" & Constants.vbLf, props.Port.ToString()) 
 
      strNetworkProperties &= String.Format("RTPPort = {0}" & Constants.vbLf, props.RTPPort.ToString()) 
 
      If props.OpenWindowsFirewall Then 
         strNetworkProperties &= "OpenWindowsFirewall = true" & Constants.vbLf 
      Else 
         strNetworkProperties &= "OpenWindowsFirewall = false" & Constants.vbLf 
      End If 
 
      Select Case props.Authentication 
         Case Authentication.Basic 
            strNetworkProperties &= "Authentication = Basic" & Constants.vbLf 
         Case Authentication.Digest 
            strNetworkProperties &= "Authentication = Digest" & Constants.vbLf 
         Case Else 
            strNetworkProperties &= "Authentication = None" & Constants.vbLf 
      End Select 
 
      strNetworkProperties &= String.Format("UserName = ""{0}""" & Constants.vbLf, props.UserName) 
 
      strNetworkProperties &= String.Format("Password = ""{0}""" & Constants.vbLf, props.Password) 
 
      strNetworkProperties &= String.Format("Realm = ""{0}""" & Constants.vbLf, props.Realm) 
 
      strNetworkProperties &= String.Format("IdleTimeOut = {0}" & Constants.vbLf, props.IdleTimeOut.ToString()) 
 
      strNetworkProperties &= String.Format("RTCPTimeOut = {0}" & Constants.vbLf, props.RTCPTimeOut.ToString()) 
 
      strNetworkProperties &= String.Format("ServerName = ""{0}""" & Constants.vbLf, props.ServerName) 
 
      If props.RTSPEnable Then 
         strNetworkProperties &= "RTSPEnable = true" & Constants.vbLf 
      Else 
         strNetworkProperties &= "RTSPEnable = false" & Constants.vbLf 
      End If 
 
      If props.RTMPEnable Then 
         strNetworkProperties &= "RTMPEnable = true" & Constants.vbLf 
      Else 
         strNetworkProperties &= "RTMPEnable = false" & Constants.vbLf 
      End If 
 
      If props.HDSEnable Then 
         strNetworkProperties &= "HDSEnable = true" & Constants.vbLf 
      Else 
         strNetworkProperties &= "HDSEnable = false" & Constants.vbLf 
      End If 
 
      If props.SSFEnable Then 
         strNetworkProperties &= "SSFEnable = true" & Constants.vbLf 
      Else 
         strNetworkProperties &= "SSFEnable = false" & Constants.vbLf 
      End If 
 
      If props.DASHEnable Then 
         strNetworkProperties &= "DASHEnable = true" & Constants.vbLf 
      Else 
         strNetworkProperties &= "DASHEnable = false" & Constants.vbLf 
      End If 
 
      strNetworkProperties &= String.Format("MediaFolder = ""{0}""" & Constants.vbLf, props.MediaFolder) 
 
      strNetworkProperties &= String.Format("ResolvedMediaFolder = ""{0}""" & Constants.vbLf, props.ResolvedMediaFolder) 
 
      strNetworkProperties += String.Format("SSLPort = ""{0}""" & Constants.vbLf, props.SSLPort.ToString()) 
 
      Dim hash As Byte() = CType(props.SSLCertificateHash, Byte()) 
      Dim strhash As String = "" 
      If hash.Length = 0 Then 
         strhash = "<empty>" 
      End If 
 
      Dim n As Integer = 0 
      Do While n < hash.Length 
         strhash &= hash(n).ToString() 
         n += 1 
      Loop 
 
      strNetworkProperties += String.Format("SSLCertificateHash = ""{0}""" & Constants.vbLf, strhash) 
 
      strNetworkProperties += String.Format("SSLCertificateStore = ""{0}""" & Constants.vbLf, props.SSLCertificateStore) 
 
      ' display a message contains the Network Properties string 
      MessageBox.Show(strNetworkProperties, "LEADTOOLS Media Streaming Examples", MessageBoxButtons.OK, MessageBoxIcon.Information) 
 
      _result = True 
   Catch e1 As Exception 
      _result = False 
   End Try 
End Sub 

Requirements

Target Platforms

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

Leadtools.MediaStreaming Assembly