@@ -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.
| API| Description|
| API| Description|
| -------- | -------- |
| constructUDPSocketInstance() | Creates a **UDPSocket** object.|
| constructTCPSocketInstance() | Creates a **TCPSocket** object.|
| bind() | Binds the IP address and port number.|
| constructUDPSocketInstance() | Creates a **UDPSocket** object.|
| constructTCPSocketInstance() | Creates a **TCPSocket** object.|
| bind() | Binds the IP address and port number.|
| send() | Sends data.|
| close() | Closes a Socket connection.|
| getState() | Obtains the Socket connection status.|
| 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.|
| on(type: 'message') | Enables listening for **message** events of the Socket connection.|
| off(type: 'message') | Disables listening for **message** events of the Socket connection.|
| on(type: 'close') | Enables listening for **close** events of the Socket connection.|
| off(type: 'close') | Disables listening for **close** events of the Socket connection.|
| on(type: 'error') | Enables listening for **error** events of the Socket connection.|
| off(type: 'error') | Disables listening for **error** events of the Socket connection.|
| close() | Closes a Socket connection.|
| getState() | Obtains the Socket connection status.|
| 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.|
| on(type: 'message') | Enables listening for **message** events of the Socket connection.|
| off(type: 'message') | Disables listening for **message** events of the Socket connection.|
| on(type: 'close') | Enables listening for **close** events of the Socket connection.|
| off(type: 'close') | Disables listening for **close** events of the Socket connection.|
| on(type: 'error') | Enables listening for **error** events of the Socket connection.|
| off(type: 'error') | Disables listening for **error** events of the Socket connection.|
| on(type: 'listening') | Enables listening for **listening** events of the UDPSocket connection. |
| off(type: 'listening') | Disables listening for **listening** events of the UDPSocket connection. |
| on(type: 'connect') | Enables listening for **connect** events of the TCPSocket connection. |
| off(type: 'connect') | Disables listening for **connect** events of the TCPSocket connection.|
| off(type: 'connect') | Disables listening for **connect** events of the TCPSocket connection.|