From d508a40bdb01ea2277a64a178070813f1767f0d4 Mon Sep 17 00:00:00 2001 From: Yangys Date: Fri, 21 Apr 2023 18:11:12 +0800 Subject: [PATCH] Add instructions for bind Signed-off-by: Yangys Change-Id: Ib5ef901c8b2e61e5d498925a2665d3cca2e87c2a --- .../reference/apis/js-apis-http.md | 2 +- .../reference/apis/js-apis-socket.md | 18 +++++++++++++++--- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/zh-cn/application-dev/reference/apis/js-apis-http.md b/zh-cn/application-dev/reference/apis/js-apis-http.md index ae7c9c8f2e..c71ced0328 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-http.md +++ b/zh-cn/application-dev/reference/apis/js-apis-http.md @@ -813,7 +813,7 @@ httpRequest.off('dataProgress'); | usingCache9+ | boolean | 否 | 是否使用缓存,默认为true。 | | priority9+ | number | 否 | 优先级,范围\[0,1000],默认是0。 | | header | Object | 否 | HTTP请求头字段。默认{'Content-Type': 'application/json'}。 | -| readTimeout | number | 否 | 读取超时时间。单位为毫秒(ms),默认为60000ms。 | +| readTimeout | number | 否 | 读取超时时间。单位为毫秒(ms),默认为60000ms。
设置为0表示不会出现超时情况。 | | connectTimeout | number | 否 | 连接超时时间。单位为毫秒(ms),默认为60000ms。 | | usingProtocol9+ | [HttpProtocol](#httpprotocol9) | 否 | 使用协议。默认值由系统自动指定。 | | usingProxy10+ | boolean \| Object | 否 | 是否使用HTTP代理,默认为false,不使用代理。
- 当usingProxy为布尔类型true时,使用默认网络代理。
- 当usingProxy为object类型时,使用指定网络代理。 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-socket.md b/zh-cn/application-dev/reference/apis/js-apis-socket.md index 812b963d36..e6124f20b0 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-socket.md +++ b/zh-cn/application-dev/reference/apis/js-apis-socket.md @@ -42,6 +42,9 @@ bind(address: NetAddress, callback: AsyncCallback\): void 绑定IP地址和端口,端口可以指定或由系统随机分配。使用callback方式作为异步方法。 +> **说明:** +> 客户端使用该方法创建socket。 + **需要权限**:ohos.permission.INTERNET **系统能力**:SystemCapability.Communication.NetStack @@ -79,6 +82,9 @@ bind(address: NetAddress): Promise\ 绑定IP地址和端口,端口可以指定或由系统随机分配。使用Promise方式作为异步方法。 +> **说明:** +> 客户端使用该方法创建socket。 + **需要权限**:ohos.permission.INTERNET **系统能力**:SystemCapability.Communication.NetStack @@ -747,6 +753,9 @@ bind(address: NetAddress, callback: AsyncCallback\): void 绑定IP地址和端口,端口可以指定或由系统随机分配。使用callback方法作为异步方法。 +> **说明:** +> 客户端使用该方法创建socket。 + **需要权限**:ohos.permission.INTERNET **系统能力**:SystemCapability.Communication.NetStack @@ -784,6 +793,9 @@ bind(address: NetAddress): Promise\ 绑定IP地址和端口,端口可以指定或由系统随机分配。使用Promise方法作为异步方法。 +> **说明:** +> 客户端使用该方法创建socket。 + **需要权限**:ohos.permission.INTERNET **系统能力**:SystemCapability.Communication.NetStack @@ -1871,7 +1883,7 @@ promise.then(() => { ### on('message') - on(type: 'message', callback: Callback<{message: ArrayBuffer, remoteInfo: SocketRemoteInfo}>): void; +on(type: 'message', callback: Callback<{message: ArrayBuffer, remoteInfo: SocketRemoteInfo}>): void; 订阅TLSSocket连接的接收消息事件。使用callback方式作为异步方法。 @@ -1882,7 +1894,7 @@ promise.then(() => { | 参数名 | 类型 | 必填 | 说明 | | -------- | ------------------------------------------------------------ | ---- | ----------------------------------------- | | type | string | 是 | 订阅的事件类型。'message':接收消息事件。 | -| callback | Callback\<{message: ArrayBuffer, remoteInfo: [SocketRemoteInfo](#socketremoteinfo)}\> | 是 | 回调函数。 +| callback | Callback\<{message: ArrayBuffer, remoteInfo: [SocketRemoteInfo](#socketremoteinfo)}\> | 是 | 回调函数。message:接收到的消息;remoteInfo:socket连接信息。 | **示例:** @@ -1916,7 +1928,7 @@ off(type: 'message', callback?: Callback\<{message: ArrayBuffer, remoteInfo: Soc | 参数名 | 类型 | 必填 | 说明 | | -------- | ------------------------------------------------------------ | ---- | ----------------------------------------- | | type | string | 是 | 订阅的事件类型。'message':接收消息事件。 | -| callback | Callback<{message: ArrayBuffer, remoteInfo: [SocketRemoteInfo](#socketremoteinfo)}> | 否 | 回调函数。 | +| callback | Callback<{message: ArrayBuffer, remoteInfo: [SocketRemoteInfo](#socketremoteinfo)}> | 否 | 回调函数。message:接收到的消息;remoteInfo:socket连接信息。 | **示例:** -- GitLab