Partager via


IWMSCacheProxyServer.DownloadContent (C#)

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

void IWMSCacheProxyServer.DownloadContent(
  string bstrOriginUrl,
  string bstrCacheUrl,
  int lBandwidth,
  int lQuotaLow,
  int lQuotaHigh,
  int lBitFlags,
  IWMSCacheProxy pICacheProxy,
  IWMSProxyContext pIProxyContext,
  IWMSCacheProxyServerCallback pCallback,
  object varContext
);

Arguments

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

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

[in] int containing the maximum bandwidth permitted for downloading. For example, if the bandwidth cannot exceed 300 Kbps, specify 307,200 (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.

[in] int 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.

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

[in] int 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.

[in] IWMSCacheProxyIWMSCacheProxy Object (C#) identifying the plug-in. Event plug-ins can use the pointer to access the cache proxy plug-in when an event occurs.

[in] IWMSProxyContextIWMSProxyContext Object (C#) that enables the server to retrieve client credentials and the name and port number of the proxy server that handles the client request.

[in] IWMSCacheProxyServerCallbackIWMSCacheProxyServerCallback Object (C#) containing the callback functions. The server calls IWMSCacheProxyServerCallback.OnDownloadContentProgress and IWMSCacheProxyServerCallback.OnDownloadContentFinished to respond to the plug-in.

[in] object 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 Value

This method does not return a value.

If this method fails, it throws an exception.

Number

Description

0x8007000E

The server could not allocate memory.

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.

Requirements

Reference: Add a reference to Microsoft.WindowsMediaServices.

Namespace: Microsoft.WindowsMediaServices.Interop.

Assembly: Microsoft.WindowsMediaServices.dll.

Library: WMSServerTypeLib.dll.

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

See Also

Concepts

IWMSCacheProxyServer Object (C#)