We use essential cookies for the website to function, as well as analytics cookies for analyzing and creating statistics of the website performance. To agree to the use of analytics cookies, click "Accept All". You can manage your preferences at any time by clicking "Cookie Settings" on the footer. More Information.

Only Essential Cookies
Accept All

About This Kit

Network Kit provides the following functions:

  • HTTP data request: initiates a data request through HTTP.

  • WebSocket connection: establishes a bidirectional connection between the server and client through WebSocket.

  • Socket connection: transmits data through Socket.

  • Network connection management: provides basic network management capabilities, including priority management of multiple network connections such as Wi-Fi, cellular, and Ethernet, network quality evaluation, subscription to default/specified network connection state changes, query of network connection information, and DNS resolution.

  • mDNS management: provides Multicast DNS (mDNS) management capabilities, such as adding, removing, discovering, and resolving local services on a LAN.

Emulator Support

Network Kit supports the Emulator, but there are differences between the Emulator and real devices. The differences are as follows:

Constraints

To use the functions of the network management module, you must obtain the permissions listed in the following table.

Before requesting permissions, ensure that the basic principles for using permissions are met. Declare the permissions required by your application. For details, see Declaring Permissions in the Configuration File.

Expand
Permission Description
ohos.permission.GET_NETWORK_INFO Allows an application to obtain the network connection information.
ohos.permission.INTERNET Allows an application to open network sockets to connect to the network.
Search in Guides
Enter a keyword.