未验证 提交 8fe37bb3 编写于 作者: K king_he 提交者: Gitee

update en/application-dev/connectivity/socket-connection.md.

Signed-off-by: Nking_he <6384784@qq.com>
上级 e62028bd
...@@ -10,26 +10,26 @@ Your application can transmit data through Socket connections. Currently, the TC ...@@ -10,26 +10,26 @@ Your application can transmit data through Socket connections. Currently, the TC
The Socket connection function is mainly implemented by the Socket module. The following table describes the related APIs. The Socket connection function is mainly implemented by the Socket module. The following table describes the related APIs.
| API| Description| | API| Description |
| -------- | -------- | | -------- | -------- |
| constructUDPSocketInstance() | Creates a **UDPSocket** object.| | constructUDPSocketInstance() | Creates a **UDPSocket** object. |
| constructTCPSocketInstance() | Creates a **TCPSocket** object.| | constructTCPSocketInstance() | Creates a **TCPSocket** object. |
| bind() | Binds the IP address and port number.| | bind() | Binds the IP address and port number. |
| send() | Sends data.| | send() | Sends data.|
| close() | Closes a Socket connection.| | close() | Closes a Socket connection. |
| getState() | Obtains the Socket connection status.| | getState() | Obtains the Socket connection status. |
| connect() | Connects to the specified IP address and port. This function is supported only for TCP.| | connect() | Connects to the specified IP address and port. This function is supported only for TCP. |
| getRemoteAddress() | Obtains the peer address of the Socket connection. This function is supported only for TCP. The **connect** API must have been called before you use this API.| | getRemoteAddress() | Obtains the peer address of the Socket connection. This function is supported only for TCP. The **connect** API must have been called before you use this API. |
| on(type:&nbsp;'message') | Enables listening for **message** events of the Socket connection.| | on(type:&nbsp;'message') | Enables listening for **message** events of the Socket connection. |
| off(type:&nbsp;'message') | Disables listening for **message** events of the Socket connection.| | off(type:&nbsp;'message') | Disables listening for **message** events of the Socket connection. |
| on(type:&nbsp;'close') | Enables listening for **close** events of the Socket connection.| | on(type:&nbsp;'close') | Enables listening for **close** events of the Socket connection. |
| off(type:&nbsp;'close') | Disables listening for **close** events of the Socket connection.| | off(type:&nbsp;'close') | Disables listening for **close** events of the Socket connection. |
| on(type:&nbsp;'error') | Enables listening for **error** events of the Socket connection.| | on(type:&nbsp;'error') | Enables listening for **error** events of the Socket connection. |
| off(type:&nbsp;'error') | Disables listening for **error** events of the Socket connection.| | off(type:&nbsp;'error') | Disables listening for **error** events of the Socket connection. |
| on(type:&nbsp;'listening') | Enables listening for **listening** events of the UDPSocket connection. | | on(type:&nbsp;'listening') | Enables listening for **listening** events of the UDPSocket connection. |
| off(type:&nbsp;'listening') | Disables listening for **listening** events of the UDPSocket connection. | | off(type:&nbsp;'listening') | Disables listening for **listening** events of the UDPSocket connection. |
| on(type:&nbsp;'connect') | Enables listening for **connect** events of the TCPSocket connection. | | on(type:&nbsp;'connect') | Enables listening for **connect** events of the TCPSocket connection. |
| off(type:&nbsp;'connect') | Disables listening for **connect** events of the TCPSocket connection.| | off(type:&nbsp;'connect') | Disables listening for **connect** events of the TCPSocket connection. |
## How to Develop ## How to Develop
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册