public class MessageOption extends Object
sendRequest.| 限定符和类型 | 字段 | 说明 |
|---|---|---|
static int |
TF_ACCEPT_FDS |
Indicates that file descriptors can be returned for the
sendRequest interface. |
static int |
TF_ASYNC |
Indicates that the
sendRequest interface is called in asynchronous mode. |
static int |
TF_SYNC |
Indicates that the
sendRequest interface is called in synchronous mode. |
static int |
TF_WAIT_TIME |
Indicates that wait seconds of sync call.
|
| 构造器 | 说明 |
|---|---|
MessageOption() |
Constructs a default
MessageOption object. |
MessageOption(int flags) |
Constructs a specified
MessageOption object using the flag specified in flags. |
MessageOption(int flags,
int waitTime) |
Constructs a specified
MessageOption object using the flag specified in flags. |
| 限定符和类型 | 方法 | 说明 |
|---|---|---|
int |
getFlags() |
Obtains a synchronous or asynchronous messaging flag of a
MessageOption object. |
int |
getWaitTime() |
Obtains the wait time.
|
void |
setFlags(int flag) |
Sets a synchronous or asynchronous messaging flag for a
MessageOption object. |
void |
setWaitTime(int waitTime) |
Sets the time to wait before determining a request timeout.
|
public static final int TF_ACCEPT_FDS
sendRequest interface.public static final int TF_ASYNC
sendRequest interface is called in asynchronous mode.public static final int TF_SYNC
sendRequest interface is called in synchronous mode.public static final int TF_WAIT_TIME
public MessageOption()
MessageOption object.
The default MessageOption object uses synchronous messaging.
public MessageOption(int flags)
MessageOption object using the flag specified in flags.flags - Indicates the flag to use for creating the object, TF_SYNC for synchronous call and
TF_ASYNC for asynchronous call.public MessageOption(int flags,
int waitTime)
MessageOption object using the flag specified in flags.flags - Indicates the flag to use for creating the object, TF_SYNC for synchronous call and
TF_ASYNC for asynchronous call.waitTime - Indicates TF_WAIT_TIME for synchronous call wait seconds to use for creating the object.public void setFlags(int flag)
MessageOption object.flag - Indicates the flag to set, TF_SYNC for synchronous messaging and
TF_ASYNC for asynchronous messaging.public int getFlags()
MessageOption object.MessageOption object.public void setWaitTime(int waitTime)
This method is usually used to set a long wait time when the writeRawData method is called to
send a large volume of data in cross-device communications. After the wait time expires,
the sender deems that the request has timed out. The default wait time is TF_WAIT_TIME.
When setting the wait time, you should consider the time consumed when the receiver returns
a large volume of data by calling the writeRawData method.
Permissions: ohos.permission.DISTRIBUTED_DATASYNC
waitTime - Indicates the wait time to set.public int getWaitTime()
After the wait time expires, the sender deems that the request has timed out.
Permissions: ohos.permission.DISTRIBUTED_DATASYNC