harmony 鸿蒙net_connection.h

  • 2025-06-12
  • 浏览 (3)

net_connection.h

Overview

Provides the C APIs of the network connection module for network management.

System capability: SystemCapability.Communication.NetManager.Core

Library: libnet_connection.so

Since: 11

Related module: NetConnection

Summary

Functions

Name Description
OH_NetConn_HasDefaultNet (int32_t *hasDefaultNet) Checks whether a default activated data network is available.
OH_NetConn_GetDefaultNet (NetConn_NetHandle *netHandle) Obtains the default activated data network.
OH_NetConn_IsDefaultNetMetered (int32_t *isMetered) Checks whether data traffic usage on the current network is metered.
OH_NetConn_GetConnectionProperties (NetConn_NetHandle *netHandle, NetConn_ConnectionProperties *prop) Obtains the link information of a data network.
OH_NetConn_GetNetCapabilities (NetConn_NetHandle *netHandle, NetConn_NetCapabilities *netCapacities) Obtains the capabilities of a data network.
OH_NetConn_GetDefaultHttpProxy (NetConn_HttpProxy *httpProxy) Obtains the default network proxy.
OH_NetConn_GetAddrInfo (char *host, char *serv, struct addrinfo *hint, struct addrinfo **res, int32_t netId) Obtains the DNS result using netId.
OH_NetConn_FreeDnsResult (struct addrinfo *res) Releases the DNS query result.
OH_NetConn_GetAllNets (NetConn_NetHandleList *netHandleList) Obtains all activated data networks.
OHOS_NetConn_RegisterDnsResolver (OH_NetConn_CustomDnsResolver resolver) Registers a custom DNS resolver.
Note: This API is deprecated since API version 13.
You are advised to use OH_NetConn_RegisterDnsResolver instead.
OHOS_NetConn_UnregisterDnsResolver (void) Unregisters a custom DNS resolver.
Note: This API is deprecated since API version 13.
You are advised to use OH_NetConn_UnregisterDnsResolver instead.
OH_NetConn_RegisterDnsResolver (OH_NetConn_CustomDnsResolver resolver) Registers a custom DNS resolver.
OH_NetConn_UnregisterDnsResolver (void) Unregisters a custom DNS resolver.
OH_NetConn_SetPacUrl (const char *pacUrl) Sets the URL of the system-level proxy auto-config (PAC) script.
OH_NetConn_GetPacUrl (char *pacUrl) Obtains the URL of the system-level PAC script.

你可能感兴趣的鸿蒙文章

harmony 鸿蒙Network Kit

harmony 鸿蒙NetConn_ConnectionProperties

harmony 鸿蒙NetConn_HttpProxy

harmony 鸿蒙NetConn_NetAddr

harmony 鸿蒙NetConn_NetCapabilities

harmony 鸿蒙NetConn_NetConnCallback

harmony 鸿蒙NetConn_NetHandle

harmony 鸿蒙NetConn_NetHandleList

harmony 鸿蒙NetConn_NetSpecifier

harmony 鸿蒙NetConn_Route

0  赞