Print Network Properties Example for C++

HRESULT PrintNetworkProperties(IltmsServer* server) 
{ 
   HRESULT hr; 
   CComPtr<IltmsNetworkProperties> props; 
 
   // print the network properties to stdout 
   _tprintf(_T("--- Network Properties ---\n\n")); 
 
   hr = server->GetNetworkProperties(&props); 
   if(FAILED(hr)) 
      goto error; 
 
   { 
      CComBSTR v; 
      hr = props->get_IPAddress(&v); 
      if(FAILED(hr)) 
         goto error; 
      _tprintf(_T("IPAddress = %s\n"), (LPCTSTR) CString(v)); 
 
   } 
   { 
      CComBSTR v; 
      hr = props->get_ActualIPAddress(&v); 
      if(FAILED(hr)) 
         goto error; 
      _tprintf(_T("ActualIPAddress = %s\n"), (LPCTSTR) CString(v)); 
 
   } 
   { 
      long v; 
      hr = props->get_Port(&v); 
      if(FAILED(hr)) 
         goto error; 
      _tprintf(_T("Port = %ld\n"), v); 
 
   } 
   { 
      long v; 
      hr = props->get_RTPPort(&v); 
      if(FAILED(hr)) 
         goto error; 
      _tprintf(_T("RTPPort = %ld\n"), v); 
 
   } 
   { 
      VARIANT_BOOL v; 
      hr = props->get_OpenWindowsFirewall(&v); 
      if(FAILED(hr)) 
         goto error; 
      _tprintf(_T("OpenWindowsFirewall = %s\n"), (v == VARIANT_TRUE) ? _T("true") : _T("false")); 
 
   } 
   { 
      ltmsAuthentication v; 
      hr = props->get_Authentication(&v); 
      if(FAILED(hr)) 
         goto error; 
      switch(v) 
      { 
      case ltmsAuthentication_Basic: 
         _tprintf(_T("Authentication = Basic\n")); 
         break; 
      case ltmsAuthentication_Digest: 
         _tprintf(_T("Authentication = Digest\n")); 
         break; 
      default: 
         _tprintf(_T("Authentication = None\n")); 
         break; 
 
      } 
 
   } 
   { 
      CComBSTR v; 
      hr = props->get_UserName(&v); 
      if(FAILED(hr)) 
         goto error; 
      _tprintf(_T("UserName = \"%s\"\n"), (LPCTSTR) CString(v)); 
 
   } 
   { 
      CComBSTR v; 
      hr = props->get_Password(&v); 
      if(FAILED(hr)) 
         goto error; 
      _tprintf(_T("Password = \"%s\"\n"), (LPCTSTR) CString(v)); 
 
   } 
   { 
      CComBSTR v; 
      hr = props->get_Realm(&v); 
      if(FAILED(hr)) 
         goto error; 
      _tprintf(_T("Realm = \"%s\"\n"), (LPCTSTR) CString(v)); 
 
   } 
   { 
      long v; 
      hr = props->get_IdleTimeOut(&v); 
      if(FAILED(hr)) 
         goto error; 
      _tprintf(_T("IdleTimeOut = %ld\n"), v); 
 
   } 
   { 
      long v; 
      hr = props->get_RTCPTimeOut(&v); 
      if(FAILED(hr)) 
         goto error; 
      _tprintf(_T("RTCPTimeOut = %ld\n"), v); 
 
   } 
   { 
      CComBSTR v; 
      hr = props->get_ServerName(&v); 
      if(FAILED(hr)) 
         goto error; 
      _tprintf(_T("ServerName = \"%s\"\n"), (LPCTSTR) CString(v)); 
 
   } 
   { 
      VARIANT_BOOL v; 
      hr = props->get_RTSPEnable(&v); 
      if(FAILED(hr)) 
         goto error; 
      _tprintf(_T("RTSPEnable = %s\n"), (v == VARIANT_TRUE) ? _T("true") : _T("false")); 
 
   } 
   { 
      VARIANT_BOOL v; 
      hr = props->get_RTMPEnable(&v); 
      if(FAILED(hr)) 
         goto error; 
      _tprintf(_T("RTMPEnable = %s\n"), (v == VARIANT_TRUE) ? _T("true") : _T("false")); 
 
   } 
   { 
      VARIANT_BOOL v; 
      hr = props->get_HDSEnable(&v); 
      if(FAILED(hr)) 
         goto error; 
      _tprintf(_T("HDSEnable = %s\n"), (v == VARIANT_TRUE) ? _T("true") : _T("false")); 
 
   } 
   { 
      VARIANT_BOOL v; 
      hr = props->get_SSFEnable(&v); 
      if(FAILED(hr)) 
         goto error; 
      _tprintf(_T("SSFEnable = %s\n"), (v == VARIANT_TRUE) ? _T("true") : _T("false")); 
 
   } 
   { 
      VARIANT_BOOL v; 
      hr = props->get_DASHEnable(&v); 
      if(FAILED(hr)) 
         goto error; 
      _tprintf(_T("DASHEnable = %s\n"), (v == VARIANT_TRUE) ? _T("true") : _T("false")); 
 
   } 
   { 
      CComBSTR v; 
      hr = props->get_MediaFolder(&v); 
      if(FAILED(hr)) 
         goto error; 
      _tprintf(_T("MediaFolder = \"%s\"\n"), (LPCTSTR) CString(v)); 
 
   } 
   { 
      CComBSTR v; 
      hr = props->get_ResolvedMediaFolder(&v); 
      if(FAILED(hr)) 
         goto error; 
      _tprintf(_T("ResolvedMediaFolder = \"%s\"\n"), (LPCTSTR) CString(v)); 
 
   } 
   { 
      long v; 
      hr = props->get_SSLPort(&v); 
      if(FAILED(hr)) 
         goto error; 
      _tprintf(_T("SSLPort = %ld\n"), v); 
 
   } 
   { 
      CComVariant v; 
      BYTE* pdata; 
      hr = props->get_SSLCertificateHash(&v); 
      if(FAILED(hr)) 
         goto error; 
 
      hr = SafeArrayAccessData(v.parray, (void**)&pdata); 
      if(FAILED(hr)) 
         goto error; 
 
      _tprintf(_T("SSLCertificateHash = ")); 
 
      if(!v.parray->rgsabound[0].cElements) 
      { 
         _tprintf(_T("<empty>")); 
      } 
      else 
      { 
         for(ULONG i = 0; i < v.parray->rgsabound[0].cElements; i++) 
         { 
            _tprintf(_T("%02X"), (UINT) pdata[i]); 
         } 
      } 
      _tprintf(_T("\n")); 
 
   } 
   { 
      CComBSTR v; 
      hr = props->get_SSLCertificateStore(&v); 
      if(FAILED(hr)) 
         goto error; 
      _tprintf(_T("SSLCertificateStore = \"%s\"\n"), (LPCTSTR) CString(v)); 
 
   } 
 
error: 
   _tprintf(_T("\n")); 
   return hr; 
} 
Help Version 20.0.2020.4.2
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2020 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Media Streaming C API Help