Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
79c87ed9
D
Docs
项目概览
OpenHarmony
/
Docs
1 年多 前同步成功
通知
159
Star
292
Fork
28
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
Docs
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
79c87ed9
编写于
5月 11, 2023
作者:
X
xujie
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
修改工具格式
Signed-off-by:
N
xujie
<
xujie223@huawei.com
>
上级
39fabc6a
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
133 addition
and
51 deletion
+133
-51
zh-cn/application-dev/reference/apis/js-apis-http.md
zh-cn/application-dev/reference/apis/js-apis-http.md
+62
-6
zh-cn/application-dev/reference/apis/js-apis-net-connection.md
.../application-dev/reference/apis/js-apis-net-connection.md
+5
-2
zh-cn/application-dev/reference/apis/js-apis-net-ethernet.md
zh-cn/application-dev/reference/apis/js-apis-net-ethernet.md
+22
-12
zh-cn/application-dev/reference/apis/js-apis-net-mdns.md
zh-cn/application-dev/reference/apis/js-apis-net-mdns.md
+2
-2
zh-cn/application-dev/reference/apis/js-apis-net-sharing.md
zh-cn/application-dev/reference/apis/js-apis-net-sharing.md
+14
-0
zh-cn/application-dev/reference/apis/js-apis-socket.md
zh-cn/application-dev/reference/apis/js-apis-socket.md
+26
-29
zh-cn/application-dev/reference/apis/js-apis-system-fetch.md
zh-cn/application-dev/reference/apis/js-apis-system-fetch.md
+2
-0
未找到文件。
zh-cn/application-dev/reference/apis/js-apis-http.md
浏览文件 @
79c87ed9
...
...
@@ -46,7 +46,7 @@ httpRequest.request(
readTimeout
:
60000
,
// 可选,默认为60000ms
usingProtocol
:
http
.
HttpProtocol
.
HTTP1_1
,
// 可选,协议类型默认值由系统自动指定
usingProxy
:
false
,
//可选,默认不使用网络代理,自API 10开始支持该属性
caPath
:
""
,
// 可选,
如果设置了此参数,系统将使用用户指定的证书路径,否则将使用系统预设的证书路径。
caPath
:
""
,
// 可选,
默认使用系统预设CA证书,自API 10开始支持该属性
},
(
err
,
data
)
=>
{
if
(
!
err
)
{
// data.result为HTTP响应内容,可根据业务需要进行解析
...
...
@@ -121,10 +121,34 @@ request(url: string, callback: AsyncCallback\<HttpResponse\>):void
|---------|-------------------------------------------------------|
| 401 | Parameter error. |
| 201 | Permission denied. |
| 2300001 | Unsupported protocol. |
| 2300003 | URL using bad/illegal format or missing URL. |
| 2300005 | Couldn't resolve proxy name. |
| 2300006 | Couldn't resolve host name. |
| 2300007 | Couldn't connect to server. |
| 2300008 | Weird server reply. |
| 2300009 | Access denied to remote resource. |
| 2300016 | Error in the HTTP2 framing layer. |
| 2300018 | Transferred a partial file. |
| 2300023 | Failed writing received data to disk/application. |
| 2300025 | Upload failed. |
| 2300026 | Failed to open/read local data from file/application. |
| 2300027 | Out of memory. |
| 2300028 | Timeout was reached. |
| 2300047 | Number of redirects hit maximum amount. |
| 2300052 | Server returned nothing (no headers, no data). |
| 2300055 | Failed sending data to the peer. |
| 2300056 | Failure when receiving data from the peer. |
| 2300058 | Problem with the local SSL certificate. |
| 2300059 | Couldn't use specified SSL cipher. |
| 2300060 | SSL peer certificate or SSH remote key was not OK. |
| 2300061 | Unrecognized or bad HTTP Content or Transfer-Encoding.|
| 2300063 | Maximum file size exceeded. |
| 2300070 | Disk full or allocation exceeded. |
| 2300073 | Remote file already exists. |
| 2300077 | Problem with the SSL CA cert (path? access rights?). |
| 2300078 | Remote file not found. |
| 2300094 | An authentication function returned an error. |
| 2300999 | Unknown Other Error. |
> **错误码说明:**
...
...
@@ -358,10 +382,34 @@ request2(url: string, callback: AsyncCallback\<number\>): void
|---------|-------------------------------------------------------|
| 401 | Parameter error. |
| 201 | Permission denied. |
| 2300001 | Unsupported protocol. |
| 2300003 | URL using bad/illegal format or missing URL. |
| 2300005 | Couldn't resolve proxy name. |
| 2300006 | Couldn't resolve host name. |
| 2300007 | Couldn't connect to server. |
| 2300008 | Weird server reply. |
| 2300009 | Access denied to remote resource. |
| 2300016 | Error in the HTTP2 framing layer. |
| 2300018 | Transferred a partial file. |
| 2300023 | Failed writing received data to disk/application. |
| 2300025 | Upload failed. |
| 2300026 | Failed to open/read local data from file/application. |
| 2300027 | Out of memory. |
| 2300028 | Timeout was reached. |
| 2300047 | Number of redirects hit maximum amount. |
| 2300052 | Server returned nothing (no headers, no data). |
| 2300055 | Failed sending data to the peer. |
| 2300056 | Failure when receiving data from the peer. |
| 2300058 | Problem with the local SSL certificate. |
| 2300059 | Couldn't use specified SSL cipher. |
| 2300060 | SSL peer certificate or SSH remote key was not OK. |
| 2300061 | Unrecognized or bad HTTP Content or Transfer-Encoding.|
| 2300063 | Maximum file size exceeded. |
| 2300070 | Disk full or allocation exceeded. |
| 2300073 | Remote file already exists. |
| 2300077 | Problem with the SSL CA cert (path? access rights?). |
| 2300078 | Remote file not found. |
| 2300094 | An authentication function returned an error. |
| 2300999 | Unknown Other Error. |
> **错误码说明:**
...
...
@@ -758,7 +806,7 @@ httpRequest.off('dataEnd');
### on('dataProgress')<sup>10+</sup>
on(type: 'dataProgress', callback:
Async
Callback
\<
{ receiveSize: number, totalSize: number }
\>
): void
on(type: 'dataProgress', callback: Callback
\<
{ receiveSize: number, totalSize: number }
\>
): void
订阅HTTP流式响应数据接收进度事件。
...
...
@@ -821,7 +869,7 @@ httpRequest.off('dataProgress');
| connectTimeout | number | 否 | 连接超时时间。单位为毫秒(ms),默认为60000ms。 |
| usingProtocol
<sup>
9+
</sup>
|
[
HttpProtocol
](
#httpprotocol9
)
| 否 | 使用协议。默认值由系统自动指定。 |
| usingProxy
<sup>
10+
</sup>
| boolean
\|
Object | 否 | 是否使用HTTP代理,默认为false,不使用代理。
<br
/>
- 当usingProxy为布尔类型true时,使用默认网络代理。
<br
/>
- 当usingProxy为object类型时,使用指定网络代理。
| caPath
<sup>
10+
</sup>
| string | 否 | 如果设置了此参数,系统将使用用户指定
的证书路径,否则将使用系统预设的证书路径。
|
| caPath
<sup>
10+
</sup>
| string | 否 | 如果设置了此参数,系统将使用用户指定
路径的CA证书,否则将使用系统预设CA证书。
|
## RequestMethod<sup>6+</sup>
...
...
@@ -936,6 +984,8 @@ flush(callback: AsyncCallback\<void\>): void
将缓存中的数据写入文件系统,以便在下一个HTTP请求中访问所有缓存数据,使用callback方式作为异步方法。
**系统接口**
:此接口为系统接口。
**系统能力**
:SystemCapability.Communication.NetStack
**参数:**
...
...
@@ -962,6 +1012,8 @@ flush(): Promise\<void\>
将缓存中的数据写入文件系统,以便在下一个HTTP请求中访问所有缓存数据,使用Promise方式作为异步方法。
**系统接口**
:此接口为系统接口。
**系统能力**
:SystemCapability.Communication.NetStack
**返回值:**
...
...
@@ -986,6 +1038,8 @@ delete(callback: AsyncCallback\<void\>): void
禁用缓存并删除其中的数据,使用callback方式作为异步方法。
**系统接口**
:此接口为系统接口。
**系统能力**
:SystemCapability.Communication.NetStack
**参数:**
...
...
@@ -1012,6 +1066,8 @@ delete(): Promise\<void\>
禁用缓存并删除其中的数据,使用Promise方式作为异步方法。
**系统接口**
:此接口为系统接口。
**系统能力**
:SystemCapability.Communication.NetStack
**返回值:**
...
...
@@ -1038,9 +1094,9 @@ http的数据类型。
| 名称 | 值 | 说明 |
| ------------------ | -- | ----------- |
| STRING | 0 | 字符串类型。 |
| OBJECT | 1 | 对象类型。 |
| ARRAY_BUFFER | 2 | 二进制数组类型。|
| STRING
<sup>
6+
</sup>
| 0 | 字符串类型。 |
| OBJECT
<sup>
6+
</sup>
| 1 | 对象类型。 |
| ARRAY_BUFFER
<sup>
6+
</sup>
| 2 | 二进制数组类型。|
## HttpProtocol<sup>9+</sup>
...
...
zh-cn/application-dev/reference/apis/js-apis-net-connection.md
浏览文件 @
79c87ed9
...
...
@@ -1195,9 +1195,10 @@ register(callback: AsyncCallback\<void>): void
| 错误码ID | 错误信息 |
| ------- | ----------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 2100002 | Operation failed. Cannot connect to service.|
| 2100003 | System internal error. |
| 2101008 | The callback is not
exists
. |
| 2101008 | The callback is not
found
. |
| 2101022 | The number of requests exceeded the maximum. |
**示例:**
...
...
@@ -1226,9 +1227,11 @@ unregister(callback: AsyncCallback\<void>): void
| 错误码ID | 错误信息 |
| ------- | ----------------------------- |
| 201 | Permission denied.|
| 401 | Parameter error. |
| 2100002 | Operation failed. Cannot connect to service.|
| 2100003 | System internal error. |
| 210
1007 | The same callback exists
. |
| 210
0207 | Remote is null
. |
**示例:**
...
...
zh-cn/application-dev/reference/apis/js-apis-net-ethernet.md
浏览文件 @
79c87ed9
...
...
@@ -36,13 +36,15 @@ setIfaceConfig(iface: string, ic: InterfaceConfiguration, callback: AsyncCallbac
| 错误码ID | 错误信息 |
| ------- | ----------------------------------------|
| 201 | Permission denied. |
| 202 | System permission denied. |
| 401 | Parameter error. |
| 2200001 | Invalid parameter value. |
| 2200002 | Operation failed. Cannot connect to service.|
| 2200003 | System internal error. |
| 2201005 | The device information does not exist. |
| 2201006 | Device disconnected. |
| 2201007 | Failed to write the user configuration. |
| 2201004 | Invalid Ethernet profile. |
| 2201005 | Device information does not exist. |
| 2201006 | Ethernet device not connected. |
| 2201007 | Ethernet failed to write user configuration information. |
**示例:**
...
...
@@ -94,13 +96,15 @@ setIfaceConfig(iface: string, ic: InterfaceConfiguration): Promise\<void>
| 错误码ID | 错误信息 |
| ------- | ----------------------------------------|
| 201 | Permission denied. |
| 202 | System permission denied. |
| 401 | Parameter error. |
| 2200001 | Invalid parameter value. |
| 2200002 | Operation failed. Cannot connect to service.|
| 2200003 | System internal error. |
| 2201005 | The device information does not exist. |
| 2201006 | Device disconnected. |
| 2201007 | Failed to write the user configuration. |
| 2201004 | Invalid Ethernet profile. |
| 2201005 | Device information does not exist. |
| 2201006 | Ethernet device not connected. |
| 2201007 | Ethernet failed to write user configuration information. |
**示例:**
...
...
@@ -144,11 +148,12 @@ getIfaceConfig(iface: string, callback: AsyncCallback\<InterfaceConfiguration>):
| 错误码ID | 错误信息 |
| ------- | ----------------------------------------|
| 201 | Permission denied. |
| 202 | System permission denied. |
| 401 | Parameter error. |
| 2200001 | Invalid parameter value. |
| 2200002 | Operation failed. Cannot connect to service.|
| 2200003 | System internal error. |
| 2201005 |
The d
evice information does not exist. |
| 2201005 |
D
evice information does not exist. |
**示例:**
...
...
@@ -197,11 +202,12 @@ getIfaceConfig(iface: string): Promise\<InterfaceConfiguration>
| 错误码ID | 错误信息 |
| ------- | ----------------------------------------|
| 201 | Permission denied. |
| 202 | System permission denied. |
| 401 | Parameter error. |
| 2200001 | Invalid parameter value. |
| 2200002 | Operation failed. Cannot connect to service.|
| 2200003 | System internal error. |
| 2201005 |
The d
evice information does not exist. |
| 2201005 |
D
evice information does not exist. |
**示例:**
...
...
@@ -243,11 +249,12 @@ isIfaceActive(iface: string, callback: AsyncCallback\<number>): void
| 错误码ID | 错误信息 |
| ------- | ----------------------------------------|
| 201 | Permission denied. |
| 202 | System permission denied. |
| 401 | Parameter error. |
| 2200001 | Invalid parameter value. |
| 2200002 | Operation failed. Cannot connect to service.|
| 2200003 | System internal error. |
| 2201005 |
The d
evice information does not exist. |
| 2201005 |
D
evice information does not exist. |
**示例:**
...
...
@@ -290,11 +297,12 @@ isIfaceActive(iface: string): Promise\<number>
| 错误码ID | 错误信息 |
| ------- | ----------------------------------------|
| 201 | Permission denied. |
| 202 | System permission denied. |
| 401 | Parameter error. |
| 2200001 | Invalid parameter value. |
| 2200002 | Operation failed. Cannot connect to service.|
| 2200003 | System internal error. |
| 2201005 |
The d
evice information does not exist. |
| 2201005 |
D
evice information does not exist. |
**示例:**
...
...
@@ -329,6 +337,7 @@ getAllActiveIfaces(callback: AsyncCallback\<Array\<string>>): void
| 错误码ID | 错误信息 |
| ------- | ----------------------------------------|
| 201 | Permission denied. |
| 202 | System permission denied. |
| 2200002 | Operation failed. Cannot connect to service.|
| 2200003 | System internal error. |
...
...
@@ -370,6 +379,7 @@ getAllActiveIfaces(): Promise\<Array\<string>>
| 错误码ID | 错误信息 |
| ------- | ----------------------------------------|
| 201 | Permission denied. |
| 202 | System permission denied. |
| 2200002 | Operation failed. Cannot connect to service.|
| 2200003 | System internal error. |
...
...
@@ -410,7 +420,7 @@ on(type: 'interfaceStateChange', callback: Callback\<{ iface: string, active: bo
| 错误码ID | 错误信息 |
| ------- | -------------------------------------------- |
| 201 | Permission denied. |
| 202 |
Applicable only to system applications.
|
| 202 |
System permission denied.
|
| 401 | Parameter error. |
**示例:**
...
...
@@ -445,7 +455,7 @@ off(type: 'interfaceStateChange', callback?: Callback\<{ iface: string, active:
| 错误码ID | 错误信息 |
| ------- | -------------------------------------------- |
| 201 | Permission denied. |
| 202 |
Applicable only to system applications.
|
| 202 |
System permission denied.
|
| 401 | Parameter error. |
**示例:**
...
...
zh-cn/application-dev/reference/apis/js-apis-net-mdns.md
浏览文件 @
79c87ed9
...
...
@@ -215,7 +215,7 @@ removeLocalService(context: Context, serviceInfo: LocalServiceInfo, callback: As
| 401 | Parameter error. |
| 2100002 | Operation failed. Cannot connect to service. |
| 2100003 | System internal error. |
| 2204002 |
Callback
not found. |
| 2204002 |
Service instance
not found. |
| 2204008 | Service instance duplicated. |
| 2204010 | Send packet failed. |
...
...
@@ -310,7 +310,7 @@ removeLocalService(context: Context, serviceInfo: LocalServiceInfo): Promise\<Lo
| 2100002 | Operation failed. Cannot connect to service. |
| 2100003 | System internal error. |
| 2204002 | Callback not found. |
| 2204008 | Service instance
duplicate
d. |
| 2204008 | Service instance
not foun
d. |
| 2204010 | Send packet failed. |
> **错误码说明:**
...
...
zh-cn/application-dev/reference/apis/js-apis-net-sharing.md
浏览文件 @
79c87ed9
...
...
@@ -108,8 +108,10 @@ isSharing(callback: AsyncCallback\<boolean>): void
| 错误码ID | 错误信息 |
| ------- | -------------------------------------------- |
| 201 | Permission denied. |
| 202 | System permission denied |
| 2200002 | Operation failed. Cannot connect to service. |
| 2200003 | System internal error. |
| 2202011 | Cannot get network sharing configuration. |
**示例:**
...
...
@@ -143,8 +145,10 @@ isSharing(): Promise\<boolean>
| 错误码ID | 错误信息 |
| ------- | -------------------------------------------- |
| 201 | Permission denied. |
| 202 | System permission denied |
| 2200002 | Operation failed. Cannot connect to service. |
| 2200003 | System internal error. |
| 2202011 | Cannot get network sharing configuration. |
**示例:**
...
...
@@ -277,10 +281,12 @@ stopSharing(type: SharingIfaceType, callback: AsyncCallback\<void>): void
| 错误码ID | 错误信息 |
| ------- | -------------------------------------------- |
| 201 | Permission denied. |
| 202 | System permission denied |
| 401 | Parameter error. |
| 2200001 | Invalid parameter value. |
| 2200002 | Operation failed. Cannot connect to service. |
| 2200003 | System internal error. |
| 2200004 | Try to share an unavailable iface. |
| 2202005 | WiFi sharing failed. |
| 2202006 | Bluetooth sharing failed. |
| 2202011 | Cannot get network sharing configuration. |
...
...
@@ -325,10 +331,12 @@ stopSharing(type: SharingIfaceType): Promise\<void>
| 错误码ID | 错误信息 |
| ------- | -------------------------------------------- |
| 201 | Permission denied. |
| 202 | System permission denied |
| 401 | Parameter error. |
| 2200001 | Invalid parameter value. |
| 2200002 | Operation failed. Cannot connect to service. |
| 2200003 | System internal error. |
| 2200004 | Try to share an unavailable iface. |
| 2202005 | WiFi sharing failed. |
| 2202006 | Bluetooth sharing failed. |
| 2202011 | Cannot get network sharing configuration. |
...
...
@@ -847,6 +855,7 @@ on(type: 'sharingStateChange', callback: Callback\<boolean>): void
| 错误码ID | 错误信息 |
| ------- | -------------------------------------------- |
| 201 | Permission denied. |
| 202 | System permission denied |
| 401 | Parameter error. |
**示例:**
...
...
@@ -881,6 +890,7 @@ off(type: 'sharingStateChange', callback?: Callback\<boolean>): void
| 错误码ID | 错误信息 |
| ------- | -------------------------------------------- |
| 201 | Permission denied. |
| 202 | System permission denied |
| 401 | Parameter error. |
**示例:**
...
...
@@ -916,6 +926,7 @@ SharingIfaceState }>): void
| 错误码ID | 错误信息 |
| ------- | -------------------------------------------- |
| 201 | Permission denied. |
| 202 | System permission denied |
| 401 | Parameter error. |
**示例:**
...
...
@@ -951,6 +962,7 @@ SharingIfaceState }>): void
| 错误码ID | 错误信息 |
| ------- | -------------------------------------------- |
| 201 | Permission denied. |
| 202 | System permission denied |
| 401 | Parameter error. |
**示例:**
...
...
@@ -985,6 +997,7 @@ on(type: 'sharingUpstreamChange', callback: Callback\<NetHandle>): void
| 错误码ID | 错误信息 |
| ------- | -------------------------------------------- |
| 201 | Permission denied. |
| 202 | System permission denied |
| 401 | Parameter error. |
**示例:**
...
...
@@ -1019,6 +1032,7 @@ off(type: 'sharingUpstreamChange', callback?: Callback\<NetHandle>): void
| 错误码ID | 错误信息 |
| ------- | -------------------------------------------- |
| 201 | Permission denied. |
| 202 | System permission denied |
| 401 | Parameter error. |
**示例:**
...
...
zh-cn/application-dev/reference/apis/js-apis-socket.md
浏览文件 @
79c87ed9
...
...
@@ -737,11 +737,11 @@ constructTCPSocketInstance(): TCPSocket
let
tcp
=
socket
.
constructTCPSocketInstance
();
```
## TCPSocket<sup>
9
+</sup>
## TCPSocket<sup>
7
+</sup>
TCPSocket连接。在调用TCPSocket的方法前,需要先通过
[
socket.constructTCPSocketInstance
](
#socketconstructtcpsocketinstance
)
创建TCPSocket对象。
### bind<sup>
9
+</sup>
### bind<sup>
7
+</sup>
bind(address: NetAddress, callback: AsyncCallback
\<
void
\>
): void
...
...
@@ -778,7 +778,7 @@ tcp.bind({address: '192.168.xx.xxx', port: xxxx, family: 1}, err => {
})
```
### bind<sup>
9
+</sup>
### bind<sup>
7
+</sup>
bind(address: NetAddress): Promise
\<
void
\>
...
...
@@ -819,7 +819,7 @@ promise.then(() => {
});
```
### connect<sup>
9
+</sup>
### connect<sup>
7
+</sup>
connect(options: TCPConnectOptions, callback: AsyncCallback
\<
void
\>
): void
...
...
@@ -859,7 +859,7 @@ tcp.connect({ address: { address: '192.168.xx.xxx', port: xxxx, family: 1 }, tim
})
```
### connect<sup>
9
+</sup>
### connect<sup>
7
+</sup>
connect(options: TCPConnectOptions): Promise
\<
void
\>
...
...
@@ -900,7 +900,7 @@ promise.then(() => {
});
```
### send<sup>
9
+</sup>
### send<sup>
7
+</sup>
send(options: TCPSendOptions, callback: AsyncCallback
\<
void
\>
): void
...
...
@@ -946,7 +946,7 @@ tcp.connect({ address: { address: '192.168.xx.xxx', port: xxxx, family: 1 }, tim
})
```
### send<sup>
9
+</sup>
### send<sup>
7
+</sup>
send(options: TCPSendOptions): Promise
\<
void
\>
...
...
@@ -998,7 +998,7 @@ promise1.then(() => {
});
```
### close<sup>
9
+</sup>
### close<sup>
7
+</sup>
close(callback: AsyncCallback
\<
void
\>
): void
...
...
@@ -1033,7 +1033,7 @@ tcp.close(err => {
})
```
### close<sup>
9
+</sup>
### close<sup>
7
+</sup>
close(): Promise
\<
void
\>
...
...
@@ -1067,7 +1067,7 @@ promise.then(() => {
});
```
### getRemoteAddress<sup>
9
+</sup>
### getRemoteAddress<sup>
7
+</sup>
getRemoteAddress(callback: AsyncCallback
\<
NetAddress
\>
): void
...
...
@@ -1108,7 +1108,7 @@ tcp.connect({ address: { address: '192.168.xx.xxx', port: xxxx, family: 1 }, tim
});
```
### getRemoteAddress<sup>
9
+</sup>
### getRemoteAddress<sup>
7
+</sup>
getRemoteAddress(): Promise
\<
NetAddress
\>
...
...
@@ -1151,7 +1151,7 @@ promise1.then(() => {
});
```
### getState<sup>
9
+</sup>
### getState<sup>
7
+</sup>
getState(callback: AsyncCallback
\<
SocketStateBase
\>
): void
...
...
@@ -1192,7 +1192,7 @@ let promise = tcp.connect({ address: { address: '192.168.xx.xxx', port: xxxx, fa
});
```
### getState<sup>
9
+</sup>
### getState<sup>
7
+</sup>
getState(): Promise
\<
SocketStateBase
\>
...
...
@@ -1235,7 +1235,7 @@ promise.then(() => {
});
```
### setExtraOptions<sup>
9
+</sup>
### setExtraOptions<sup>
7
+</sup>
setExtraOptions(options: TCPExtraOptions, callback: AsyncCallback
\<
void
\>
): void
...
...
@@ -1287,7 +1287,7 @@ let promise = tcp.connect({ address: { address: '192.168.xx.xxx', port: xxxx, fa
});
```
### setExtraOptions<sup>
9
+</sup>
### setExtraOptions<sup>
7
+</sup>
setExtraOptions(options: TCPExtraOptions): Promise
\<
void
\>
...
...
@@ -1346,7 +1346,7 @@ promise.then(() => {
});
```
### on('message')<sup>
9
+</sup>
### on('message')<sup>
7
+</sup>
on(type: 'message', callback: Callback<{message: ArrayBuffer, remoteInfo: SocketRemoteInfo}
\>
): void
...
...
@@ -1377,7 +1377,7 @@ tcp.on('message', value => {
});
```
### off('message')<sup>
9
+</sup>
### off('message')<sup>
7
+</sup>
off(type: 'message', callback?: Callback<{message: ArrayBuffer, remoteInfo: SocketRemoteInfo}
\>
): void
...
...
@@ -1415,7 +1415,7 @@ tcp.off('message', callback);
tcp
.
off
(
'
message
'
);
```
### on('connect' | 'close')<sup>
9
+</sup>
### on('connect' | 'close')<sup>
7
+</sup>
on(type: 'connect' | 'close', callback: Callback
\<
void
\>
): void
...
...
@@ -1442,7 +1442,7 @@ tcp.on('close', () => {
});
```
### off('connect' | 'close')<sup>
9
+</sup>
### off('connect' | 'close')<sup>
7
+</sup>
off(type: 'connect' | 'close', callback?: Callback
\<
void
\>
): void
...
...
@@ -1480,7 +1480,7 @@ tcp.off('close', callback2);
tcp
.
off
(
'
close
'
);
```
### on('error')<sup>
9
+</sup>
### on('error')<sup>
7
+</sup>
on(type: 'error', callback: ErrorCallback): void
...
...
@@ -1504,7 +1504,7 @@ tcp.on('error', err => {
});
```
### off('error')<sup>
9
+</sup>
### off('error')<sup>
7
+</sup>
off(type: 'error', callback?: ErrorCallback): void
...
...
@@ -1535,7 +1535,7 @@ tcp.off('error', callback);
tcp
.
off
(
'
error
'
);
```
## TCPConnectOptions<sup>
9
+</sup>
## TCPConnectOptions<sup>
7
+</sup>
TCPSocket连接的参数。
...
...
@@ -1546,7 +1546,7 @@ TCPSocket连接的参数。
| address |
[
NetAddress
](
#netaddress
)
| 是 | 绑定的地址以及端口。 |
| timeout | number | 否 | 超时时间,单位毫秒(ms)。 |
## TCPSendOptions<sup>
9
+</sup>
## TCPSendOptions<sup>
7
+</sup>
TCPSocket发送请求的参数。
...
...
@@ -1557,7 +1557,7 @@ TCPSocket发送请求的参数。
| data | string
\|
ArrayBuffer
<sup>
7+
</sup>
| 是 | 发送的数据。 |
| encoding | string | 否 | 字符编码(UTF-8,UTF-16BE,UTF-16LE,UTF-16,US-AECII,ISO-8859-1),默认为UTF-8。 |
## TCPExtraOptions<sup>
9
+</sup>
## TCPExtraOptions<sup>
7
+</sup>
TCPSocket连接的其他属性。
...
...
@@ -2663,7 +2663,7 @@ send(data: string, callback: AsyncCallback\<void\>): void
| ------- | -------------------------------------------- |
| 401 | Parameter error. |
| 2303501 | SSL is null. |
| 2303503 | Error in tls writing |
| 2303503 | Error in tls writing
.
|
| 2303505 | Error occurred in the tls system call. |
| 2303506 | Error clearing tls connection. |
| 2300002 | System internal error. |
...
...
@@ -2700,7 +2700,7 @@ send(data: string): Promise\<void\>
| ------- | -------------------------------------------- |
| 401 | Parameter error. |
| 2303501 | SSL is null. |
| 2303503 | Error in tls writing |
| 2303503 | Error in tls writing
.
|
| 2303505 | Error occurred in the tls system call. |
| 2303506 | Error clearing tls connection. |
| 2300002 | System internal error. |
...
...
@@ -2835,6 +2835,3 @@ TLS通信的协议版本。
**系统能力**
:SystemCapability.Communication.NetStack
| 类型 | 说明 |
| --------------------------------------------------------------------- | --------------------- |
|
[
cert.EncodingBlob
](
js-apis-cert.md#datablob
)
| 存储证书的数据和编码格式 |
zh-cn/application-dev/reference/apis/js-apis-system-fetch.md
浏览文件 @
79c87ed9
...
...
@@ -45,6 +45,8 @@ fetch(Object): void
## FetchResponse<sup>3+</sup>
**系统能力:**
SystemCapability.Communication.NetStack
| 名称 | 类型 | 可读 | 可写 | 说明 |
| -------- | -------- | -------- | -------- | -------- |
| code | number | 是 | 否 | 表示服务器的状态code。 |
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录