主要内容

matlab.net.http.。进展class

Package:matlab.net.http.
Superclasses:handle

Progress monitor for HTTP message exchange

Description

Use the进展类以实现HTTP请求消息的进度监视器。进度监视器侦听此类属性的更改,以实现您选择的显示或更新。

要实现进度监视器,请创建此类的子类。然后创建一个HTTPOptions对象,指定子类作为进展Fcnproperty, and set theUseProgressMonitorproperty to真的

An HTTP request starts when you call theRequestMessage.send.send.send.方法。The process might involve multiple messages in both directions in the case of redirects and authentication. MATLAB®calls the完毕method when all transfers have been completed.

During a transfer:

  • Matlab套装theMax,CANDECCN., 和方向你打电话的物业RequestMessage.send.send.send.

  • Matlab套装the价值property repeatedly as the body of the request message is sent to indicate the number of bytes transferred.

  • When receipt of the回复Messagebegins, MATLAB sets方向to回复再次套装价值repeatedly.

  • To cancel the transfer at any time, call theCANDECCN.function. This action is the same as interrupting the发送function in the Command Window.

您可以显示图形进度指示符或其他迹象方向更改回复。For each subsequent价值, update the indicator to the current价值。You can also use this mechanism to monitor progress programmatically.

Thematlab.net.http.。进展班级是A.handleclass.

Creation

obj = matlab.net.http.progress monitor(名称,值)creates a progress monitor with additional properties specified by one, or more name-value pair arguments.Nameis the property name and价值is the corresponding value. You can specify several name-value pair arguments in any order asname1,value1,...,namen,valuen。Unspecified properties are set to their default values.

Properties

expand all

Seconds to first call and maximum interval between calls, specified as double.

Interval是在第一次设置之前转移开始后几秒钟的时间价值property.Interval是一个建议的设置之间的最大时间价值,无论进步如何。如果转移数据的总时间小于Intervalseconds, then价值is not set. If no data has been transferred inIntervalseconds since the last setting of价值, then价值might be set again to the same value. In this way, your进展对象可以取消传输(通过呼叫CANDECCN.) even if there is no progress.

TheInterval价值是一个建议的值。无法保证Matlab套装价值之内Interval如果没有进展,则秒。

The default interval is two seconds. To specify a different value, setInterval在你的构造函数中。连续设置之间的最小间隔价值when there is no progress is 0.1 seconds. However, if价值更改,它可能比此间隔更频繁地设置。

After setting价值the first time, there is no delay in setting价值对于同一交换中的后续邮件。

监视器在使用指标,指定为真的或者false。Matlab套装this property to indicate whether it is using this进展object during a transfer.InUseprevents you from reusing this object for more than one transfer at a time.

Data Types:logical

Function to call to cancel a transfer, specified as a function handle. MATLAB setsCANDECCN.到功能你的进展should call to cancel a transfer. Calling this function has the same effect as interrupting the transfer in the Command Window.

Maximum length of the transfer, specified asuint64。If the maximum length is not known,Maxis[]Max是显示进度指示符的最大值。

Matlab套装Max在每个发送和接收操作的开头,基于Content-Length标题字段,将操作转移到要传输的预期字节数。

如果消息不包含内容长度字段,Maxis[]。在这种情况下,您无法确定已完成的传输的比例。但是,您可以监控更改价值property.

转移方向, specified as amatlab.net.http.messageType.目的。Matlab套装方向表示是否针对请求消息或响应消息监视进度。如果没有转移,那么方向是空的。

到目前为止转移的字节数, specified asuint64。Matlab套装价值repeatedly to the total number of bytes transferred for the current message. However, it delays setting this property the first time in an exchange until at leastIntervalseconds have elapsed since the start of the message.

Implement aset.Value该属性的方法,以监测转移的进度。您还可以实现从进度监视器中取消转帐的能力set.Value方法。

matlab可能会设置价值to empty at the end of a given transfer, to indicate that transfer in the current direction has ended. MATLAB always sets价值在召唤之前结束所有转移之前完毕方法。

You cannot control the frequency at which MATLAB updates the价值property. However, MATLAB might set价值at least once everyInterval秒,即使没有进展。此行为允许您调用CANDECCN.if a transfer is not progressing.价值如果没有传输字节,则可能为零Interval转移开始以来的几秒钟。

方法

expand all

版本历史

Introduced in R2016b