Share via


IWMSCacheProxyServer::DownloadContent

banner art

Previous Next

IWMSCacheProxyServer::DownloadContent

The DownloadContent method is called by the cache plug-in to download content to a cache.

Syntax

  HRESULT DownloadContent(
  
  BSTR
  
  bstrOriginUrl
  ,
  
  BSTR
  
  bstrCacheUrl
  ,
  
  long
  
  lBandwidth
  ,
  
  long
  
  lQuotaLow
  ,
  
  long
  
  lQuotaHigh
  ,
  
  long
  
  lBitFlags
  ,
  
  IWMSCacheProxy*
  
  pICacheProxy
  ,
  IWMSProxyContext*  pIProxyContext,IWMSCacheProxyServerCallback*pCallback,VARIANTvarContext);

Parameters

bstrOriginUrl

[in] BSTR containing the URL on the origin server identifying the location of the content to download.

bstrCacheUrl

[in] BSTR containing the URL on the cache server identifying the location to which content can be downloaded.

lBandwidth

[in] long containing the maximum bandwidth permitted for downloading. For example, if the bandwidth cannot exceed 300 Kbps, specify 307200 (300 * 1024). A value of -1 indicates that the bandwidth is unlimited. A value of zero directs that the stream be sent in real time. You can use this parameter to specify a rate other than real time only if the plug-in indicates that the server must use a TCP-based protocol (HTTP or RTSPT) to download content.

lQuotaLow

[in] long containing the low-order bits of a 64-bit unsigned integer that contains the maximum disk space that can be allotted for a download. If the downloaded content would consume more disk space than the maximum permitted, the server stops the download when the maximum is reached.

lQuotaHigh

[in] long containing the high-order bits of a 64-bit unsigned integer that contains the maximum disk space that can be allotted for a download.

lBitFlags

[in] long containing the bit flags. This can be either zero or the following value.

Value Description
WMS_CACHE_CONTENT_DOWNLOAD_ABORT_IF_BCAST The content is a broadcast and cannot be downloaded.

pICacheProxy

[in] Pointer to an IWMSCacheProxy interface identifying the plug-in. Event plug-ins can use the pointer to access the cache proxy plug-in when an event occurs.

pIProxyContext

[in, optional] Pointer to an IWMSProxyContext interface that enables the server to retrieve client credentials and the name and port number of the proxy server that handles the client request.

pCallback

[in, optional] Pointer to an IWMSCacheProxyServerCallback interface. The server calls IWMSCacheProxyServerCallback::OnDownloadContentProgress and IWMSCacheProxyServerCallback::OnDownloadContentFinished to respond to the plug-in.

varContext

[in, optional] VARIANT containing a value defined by the plug-in. For example, your plug-in can use this parameter to persist state information. The server does not alter this value and passes it back when calling IWMSCacheProxyServerCallback::OnDownloadContentProgress or IWMSCacheProxyServerCallback::OnDownloadContentFinished.

Return Values

If the method succeeds, it returns S_OK. If it fails, it returns an HRESULT error code.

Return code Number Description
E_INVALIDARG 0x80070057 The bstrOriginUrl, bstrCacheUrl, or pCallback parameters are NULL.
E_OUTOFMEMORY 0x8007000E The server could not allocate memory.
NS_E_INTERNAL 0xC00D0024 The pICacheProxy parameter is NULL.

Remarks

It is recommended that cache proxy plug-ins direct the cache manager to use a TCP-based protocol such as HTTP or RTSPT when connecting to the origin server to download content. TCP-based protocols minimize lost packets and enable the plug-in to download content at a rate other than real time. You must specify a value greater than zero in the lBandwidth parameter to download content at a rate other than real time.

It is also recommended that you monitor the download process to determine whether content is actually being downloaded. Some malicious server attacks can make it impossible for the download process to begin. Therefore, if no content is being downloaded after an appropriate amount of time, close the connection.

Example Code

  

Requirements

Header: streamcache.h.

Library: WMSServerTypeLib.dll.

Platform: Windows Server 2003, Enterprise Edition; Windows Server 2003, Datacenter Edition; Windows Server 2008.

See Also

Previous Next