Network data transmission is one of the core features of an app. The transmission performance significantly influences user experience. For example, in scenarios such as loading high-definition videos or images, uploading or downloading large files, and synchronizing or migrating multiple files between devices, poor network transmission performance often causes frame freezing and long waiting time, deteriorating user experience. In such performance-sensitive scenarios, Network Boost Kit provides multi-network concurrency for network acceleration.
This topic describes the mechanism and basic development process of multi-network concurrency, and introduces the adaptation solution of multi-network concurrency in two application scenarios: multipart transmission of large files and concurrent transmission of multiple files.
Multi-network concurrency refers to establishing and utilizing multiple network paths at the same time by using system APIs, for example, concurrently using Wi-Fi and mobile data, or the mobile data paths of both the primary and secondary SIM cards. Multi-network concurrency can break the default bandwidth and rate limits of single-network transmission, accelerating network transmission. After an app initiates a request for multi-network concurrency, the device determines the concurrency combination, implements concurrency control based on the service scenario, and measures the benefits of concurrency. The principles for using multi-network concurrency are as follows: app-initiated requests (with restricted permissions), system-level governance, and minimal usage.
Prepare for development.
Multi-network concurrency has certain restrictions on device types, network status, and development solutions. For details about the access requirements, see Initiating and Releasing Multi-Network Concurrency. You can also analyze errors by referring to netHandover.requestMultiPath during debugging.
Initiate multi-network concurrency.
(1) Permission configuration: The ohos.permission.LINKTURBO permission is required for some network handover APIs. For details about how to configure the permission, please refer to Procedure. In addition, this permission is a restricted ACL permission that requires special configuration and request. For details, please refer to Configuring Signature Information and Requesting a Restricted ACL Permission.
(2) Initiation process: Set the scenario using netBoost.setSceneDesc(), query the quota using netHandover.getMultiPathQuotaStats(), initiate a request using netHandover.requestMultiPath(), and listen to the status using netHandover.on('multiPathStateChange'). For details, please refer to Code Implementation.
Obtain multi-network concurrency NetHandles and bind sockets.
(1) After a multi-network concurrency request is successfully initiated, you can listen to and obtain the available NetHandle objects in the netHandover.on('multiPathStateChange') callback.
(2) When data needs to be transmitted on multiple networks, create the corresponding TCP sockets/UDP sockets and bind the sockets to the networks corresponding to the NetHandles by using the bindSocket() method.
Initiate network transmission tasks through sockets.
After a network is bound, the TCP socket/UDP socket uses the corresponding network path for data transmission. Multiple sockets use different network paths to initiate network transmission tasks at the same time, thereby achieving multi-network concurrency.
When a video post is published or an app resource package is downloaded, the app is essentially performing large file network transmission. By dividing a large file into fragments, it maximizes the multi-network concurrency capability, and allocates different file fragments to different network paths for simultaneous transmission, which greatly accelerates the transmission speed.
Initiate and access multi-network concurrency.
Set the multi-network concurrency scenario through netBoost.setSceneDesc() as required by the current network transmission task to help the device control multi-network concurrency and analyze the service duration. Currently, the upload scenario is selected for the multipart file upload task.
/**
* Enter or exit 'upload' scene.
* @param enter true enter,false exit.
* */
export function setUploadSceneDesc(enter: boolean): boolean {
try {
let sceneDesc: netBoost.SceneDesc = {
scene: 'upload',
sceneEvent: enter ? netBoost.SceneEvent.SCENE_EVENT_ENTER : netBoost.SceneEvent.SCENE_EVENT_LEAVE
};
netBoost.setSceneDesc(sceneDesc);
return true;
} catch (err) {
const error: BusinessError = err as BusinessError;
hilog.error(DOMAIN, TAG, `[setUploadSceneDesc] Error:${error.code},${error.name}`);
return false;
}
} Obtain the current multi-network concurrency quota information (including the number of sessions and duration) through netHandover.getMultiPathQuotaStats(). The app can add service logic as required, for example, prompting the user with the remaining quota.
/**
* Obtain multi-network quota information.
* @returns multi-network quota.
* */
export function getMultiPathQuota(): netHandover.MultiPathQuota | undefined {
try {
let quota: netHandover.MultiPathQuota = netHandover.getMultiPathQuotaStats();
return quota;
} catch (err) {
const error: BusinessError = err as BusinessError;
hilog.error(DOMAIN, TAG, `[getMultiPathQuota] Error:${error.code},${error.name}`);
return;
}
} Request to enable multi-network concurrency through netHandover.requestMultiPath(). Concurrent Wi-Fi and cellular networks, as well as concurrent primary and secondary SIM cards, are supported. You cannot specify the concurrent combination, which is determined by the device.
/**
* Request a multi-network path.
* @returns Returns true on success, otherwise false.
* */
export function requestMultiPath(): Promise<boolean> {
return new Promise((resolve) => {
try {
netHandover.requestMultiPath((data: netHandover.MultiPathRequestResult) => {
if (data && data.result === netHandover.MultiPathErrorResult.MULTIPATH_ERROR_NONE) {
resolve(true);
} else {
resolve(false);
}
});
} catch (err) {
resolve(false);
const error: BusinessError = err as BusinessError;
hilog.error(DOMAIN, TAG, `[requestMultiPath] Error:${error.code},${error.name}`);
}
})
} After the multi-network concurrency request succeeds, use netHandover.on('multiPathStateChange') to listen to the multi-network concurrency status, check whether the multiple network paths are enabled and available, and record the available NetHandle information.
/**
* Enable multi-network listening.
* @param netHandleChange The callback when the netHandle changes.
*/
export function setOnMultiPathStateChange(netHandleChange: NetHandleChange) {
try {
netHandover.on('multiPathStateChange', (data: netHandover.MultiPathStateInfo) => {
if (data.multiPathState === netHandover.MultiPathState.MULTIPATH_CREATED &&
data.netHandle.netId >= CommonConst.MIN_USEFUL_NET_ID) {
netHandleChange?.onMultiNetSuccess(data.netHandle);
} else if (data.multiPathState === netHandover.MultiPathState.MULTIPATH_CREATING) {
hilog.info(DOMAIN, TAG, `[setOnMultiPathStateChange.multiPathStateChange] ${data.netHandle.netId} Creating`);
} else {
netHandleChange?.onMultiNetRelease(data.netHandle);
}
});
} catch (err) {
const error: BusinessError = err as BusinessError;
hilog.error(DOMAIN, TAG, `[setOnMultiPathStateChange] Error:${error.code},${error.name}`);
}
} Bind sockets to multiple network paths.
Encapsulate the network query function and obtain all network information by using connection.getAllNetsSync(). Network transmission tasks are usually implemented in child threads. However, socket and NetHandle objects currently cannot be transferred across threads. To bind sockets to networks in child threads, you need to obtain all network information, and then use the NetHandle object IDs recorded after the multi-network concurrency request succeeds to locate the specified networks and perform the binding operation. If the service does not involve multiple threads, directly bind the NetHandles obtained in the previous step.
/**
* Get all netHandles.
* @returns Returns all netHandles on success,otherwise returns undefined
* */
export function getAllNetHandles(): connection.NetHandle[] | undefined {
try {
let netHandles = connection.getAllNetsSync();
const constNetHandles: connection.NetHandle[] = [];
for (let i = 0; i < netHandles.length; i++) {
hilog.info(DOMAIN, TAG, `[getAllNetHandles] success [${i}]>>>${netHandles[i].netId}`);
if (netHandles[i].netId >= CommonConst.MIN_USEFUL_NET_ID) {
constNetHandles.push(netHandles[i]);
}
}
return constNetHandles;
} catch (err) {
const error: BusinessError = err as BusinessError;
hilog.error(DOMAIN, TAG, `[getAllNetHandles] Error:${error.code},${error.name}`);
return undefined;
}
} Traverse all obtained networks and bind the available networks recorded in multi-network concurrency status listening to sockets using bindSocket(). The bound networks will be used when TCP sockets perform network transmission tasks.
/**
* Binds the socket to the specified network path.
* @param socketInstance socket client.
* @param netId netHandle Id.
* @param port binds port.
* */
export async function bindSpecifiedNet(socketInstance: socket.TCPSocket, netId: number, port: number) {
const netHandles = getAllNetHandles();
if (netHandles) {
for (let i = 0; i < netHandles.length; i++) {
if (netHandles[i].netId === netId) {
try {
const connectionProperties = connection.getConnectionPropertiesSync(netHandles[i]);
if (connectionProperties && connectionProperties.linkAddresses &&
connectionProperties.linkAddresses.length > 0) {
let netAddress: socket.NetAddress = {
address: connectionProperties.linkAddresses[0].address.address,
port: port
};
await socketInstance.bind(netAddress);
await netHandles[i].bindSocket(socketInstance);
} else {
hilog.error(DOMAIN, TAG, `[socketBindNet] Get ConnectionProperties error`);
}
} catch (err) {
const error: BusinessError = err as BusinessError;
hilog.error(DOMAIN, TAG, `[socketBindNet] Error occurred:${error.code},${error.name}`);
}
break;
}
}
} else {
hilog.error(DOMAIN, TAG, `Net Empty`);
}
} Handle file fragmentation.
Encapsulate a file processing class and define the fragment file data structure, including the number of current file fragments, start position, fragment size, and number of fragment retries.
/**
* File upload chunk info.
* */
export class FileUpChunk {
chunkNumber: number = 1;
startPosition: number = 0;
chunkSize: number = 0;
buffer: ArrayBuffer = new ArrayBuffer(0);
retryTimes: number = 0;
} Provide a method to calculate the fragment specifications based on the file size. You can implement the fragmentation policy as required.
function getChunkSize(fileSize: number): number {
const MB = CommonConst.MIN_SLICE_FILE_SIZE;
const fullMBs = Math.floor(fileSize / MB);
let res = Math.max(1, Math.min(CommonConst.MAX_SLICE_FILE_COUNT, fullMBs));
hilog.info(DOMAIN, TAG, `[getChunkSize] FileSize:${fileSize},ChunkSize:${res}`);
return res;
} Obtain the file size and other information using fileIo.statSync() and fragment the file based on the calculated fragment specifications.
/**
* Splits the file into segments.
* @param file An opened file
* @returns Returns all segments of the file.
*/
export function splitFile(file: fileIo.File): FileUpChunk[] {
try {
const fileStat = fileIo.statSync(file.fd);
const fileSize = fileStat.size;
const chunks: FileUpChunk[] = [];
let chunkNumber = 1;
const splitChunkSize = Math.floor(fileStat.size / getChunkSize(fileSize));
for (let start = 0; start < fileSize; start += splitChunkSize) {
const chunkSize = Math.min(splitChunkSize, fileSize - start);
const chunk = new FileUpChunk();
chunk.chunkNumber = chunkNumber++;
chunk.startPosition = start;
chunk.chunkSize = chunkSize;
chunks.push(chunk);
}
hilog.info(DOMAIN, TAG, `[splitFile] success`);
return chunks;
} catch (error) {
const err: BusinessError = error as BusinessError;
hilog.error(DOMAIN, TAG, `[splitFile] errror:${err.code},${err.name}`);
return [];
}
} Upload different file fragments through multiple sockets concurrently.
Encapsulate a fragment file upload class. Provide an API for initializing multipart upload and notify the server of the storage path of the file fragments to be uploaded. The code snippet here is for reference only. You can adjust the communication format and request parameters based on the actual service implementation mode.
/**
* Initializes the upload.
* @param host Server host.
* @param port Server port.
* @param uploadFileName File save path.
* @returns Returns a 'InitiateMultipartUpload' object if success,otherwise returns undefined.
*/
@Concurrent
async function initMultiPartUpload(host: string, port: number,
uploadFileName: string): Promise<InitiateMultipartUpload | undefined> {
const objectKey: string = uploadFileName;
const path = `/${objectKey}?uploads`;
const method = http.RequestMethod.POST;
const date = new Date().toUTCString();
// build request headers
const headers = [
`Host: ${host}`,
`Date: ${date}`,
`Content-Length: 0`,
`Content-Type: application/xml`,
`Connection: close`
];
// build request info
const request = `${method} ${path} HTTP/1.1\r\n` + headers.join('\r\n') + CommonConst.HEADER_BODY_DELIMITER;
// request data by socket
const value: socket.SocketMessageInfo | undefined = await getDataBySocket(host, port, request);
// parse result
if (value) {
try {
let responseStr = buffer.from(value.message).toString('utf-8');
const uploadIdMatch = responseStr.match(/<UploadId>(.*?)<\/UploadId>/);
if (uploadIdMatch && uploadIdMatch[1]) {
// start build 'InitiateMultipartUpload' object
let result = XmlUtils.xmlToObj(extractHttpBody(responseStr), true);
if (result && result['initiateMultipartUploadResult']) {
const json: object = result['initiateMultipartUploadResult'];
if (json) {
return {
bucket: json['bucket'],
key: json['key'],
uploadId: json['uploadId']
} as InitiateMultipartUpload;
}
return undefined;
} else {
hilog.error(0x0000, 'FilePartsUploadManager',
`[initiateMultipartUploadResult.onResult]: parse xml info error`);
return undefined;
}
} else {
hilog.error(0x0000, 'FilePartsUploadManager', `[initMultiPartUpload] onMessage ignore`);
return undefined;
}
} catch (error) {
const err: BusinessError = error as BusinessError;
hilog.error(0x0000, 'FilePartsUploadManager', `[uploadPart] buffer.from error:${err.code},${err.name}`);
return undefined;
}
} else {
return undefined;
}
} Encapsulate a network upload API, including creating TCP socket instances and binding them to specified NetHandles, setting network request headers, sending requests to the server using the TCPSocket.send() method, and listening for responses using TCPSocket.on('message').
/**
* Upload file segment.
* @param host Server host.
* @param port Server port.
* @param initResult An 'InitiateMultipartUpload' object.
* @param fileChunk File info to uploaded.
* @param netId The ID of the netHandle to bind.
* @returns Returns a 'UploadPartResult' object if success,otherwise returns undefined
*/
@Concurrent
async function uploadSegment(host: string, port: number, initResult: InitiateMultipartUpload, fileChunk: FileUpChunk,
netId: number): Promise<UploadPartResult | undefined> {
const socketInstance: socket.TCPSocket = socket.constructTCPSocketInstance();
await bindSpecifiedNet(socketInstance, netId, CommonConst.SOCKET_BIND_UP_PORT);
const path = `/${initResult.key}?partNumber=${fileChunk.chunkNumber}&uploadId=${initResult.uploadId}`;
const method = http.RequestMethod.PUT;
const date = new Date().toUTCString();
// build request header
const headers = [
`Host: ${host}`,
`Date: ${date}`,
`Content-Length: ${fileChunk.chunkSize}`,
`Content-Type: application/octet-stream`,
`Connection: close`
];
const requestHeader = `${method} ${path} HTTP/1.1\r\n` + headers.join('\r\n') + CommonConst.HEADER_BODY_DELIMITER;
const headerBuffer = buffer.from(requestHeader, 'utf-8').buffer;
// build request header and body
const requestBuffer = new Uint8Array(headerBuffer.byteLength + fileChunk.buffer.byteLength);
requestBuffer.set(new Uint8Array(headerBuffer), 0);
requestBuffer.set(new Uint8Array(fileChunk.buffer), headerBuffer.byteLength);
// get value from socket
const value: socket.SocketMessageInfo | undefined =
await getDataBySocket(host, port, requestBuffer.buffer, socketInstance);
// parse value
if (value) {
try {
let responseStr = buffer.from(value.message).toString('utf-8');
// Get ETag
const eTagMatch = responseStr.match(/ETag: "([^"]+)"/);
if (eTagMatch && eTagMatch[1]) {
return ({
partNumber: fileChunk.chunkNumber,
eTag: eTagMatch[1]
} as UploadPartResult);
} else {
hilog.error(0x0000, 'FilePartsUploadManager',
`[uploadPart] onMessage--> fileChunkId:${fileChunk.chunkNumber} upload Faild`);
return undefined;
}
} catch (error) {
const err: BusinessError = error as BusinessError;
hilog.error(0x0000, 'FilePartsUploadManager',
`[uploadPart] buffer.from error:${err.code},${err.name},fileChunkId:${fileChunk.chunkNumber}`);
return undefined;
}
} else {
return undefined;
}
} Encapsulate a file fragment transmission method through the network upload API, including reading the current file fragment, creating a child thread for the current NetHandle to initiate an upload task, updating the upload progress based on the file fragment information, and retrying upon failure. After the current fragment is transmitted, call this method cyclically to upload the remaining fragments until no fragment is left.
/**
* Upload file segment using assigned net.
*/
private async uploadFileChunkWithNet(netHandle: connection.NetHandle) {
if (this.abortUpload) {
return;
}
if (this.fileChunks.length === 0) {
hilog.info(DOMAIN, TAG, `[MultiNetworkUploader.uploadFileChunkWithNet] fileChunks empty`);
this.checkUploadSuccess();
return;
}
const fileChunk = this.fileChunks.shift()!;
let fileChunkWithData = readFileChunkBuffer(this.file!, fileChunk);
// start upload a file chunk
if (fileChunkWithData) {
const task =
new taskpool.Task(uploadSegment, CommonConst.UP_HOST, CommonConst.HTTP_DEFAULT_PORT, this.initMultipartUpload!,
fileChunkWithData, netHandle.netId);
try {
const uploadPartRes = await taskpool.execute(task);
// upload success
if (uploadPartRes) {
this.uploadResult.push(uploadPartRes as UploadPartResult);
this.uploadFileChunkWithNet(netHandle);
this.onProgressUpdate(this.uploadResult.length / this.fileChunksSize);
} else {
this.retryUpload(fileChunk, netHandle);
hilog.error(DOMAIN, TAG, `[uploadFileChunkWithNet] upload failed`);
}
} catch (error) {
this.retryUpload(fileChunk, netHandle);
const err: BusinessError = error as BusinessError;
hilog.error(DOMAIN, TAG, `[uploadFileChunkWithNet] taskpool error occurred:${err.code},${err.name}`);
}
} else {
this.retryUpload(fileChunk, netHandle);
hilog.error(DOMAIN, TAG, `[uploadFileChunkWithNet] readFileChunkBuffer failed`);
}
} Traverse NetHandles and call the method for uploading file fragments. Assign network transmission tasks to each network path, implementing file fragment transmission through multiple paths.
/**
* Start upload file.
*/
public startUpload() {
if (!this.netHandles || this.netHandles.length === 0) {
hilog.error(DOMAIN, TAG, `[MultiNetworkUploader.startUpload] netHandles is empty`);
return;
}
if (!this.fileChunks || this.fileChunks.length === 0) {
hilog.error(DOMAIN, TAG, `[MultiNetworkUploader.startUpload] fileChunks is empty`);
return;
}
for (let i = 0; i < this.netHandles.length; i++) {
this.uploadFileChunkWithNet(this.netHandles[i]);
}
} Notify the server to integrate file fragments.
After all file fragments are uploaded, notify the server of the file fragment sequence for file integration.
/**
* Merge all file segments.
* */
private async mergeSegmentsOnServer() {
fileIo.close(this.file?.fd).catch((error: BusinessError) => {
hilog.error(DOMAIN, TAG, `[mergeSegmentsOnServer] Close file error:${error.code},${error.name}`);
});
this.uploadResult.sort((a, b) => a.partNumber - b.partNumber);
const task = new taskpool.Task(completeMultiPartUploadRequest, CommonConst.UP_HOST, CommonConst.HTTP_DEFAULT_PORT,
this.initMultipartUpload!,
this.uploadResult);
try {
const res = await taskpool.execute(task);
if (res) {
this.onUploadSuccess();
} else {
this.onFailed();
}
} catch (error) {
this.onFailed();
}
} Release resources.
Release multi-network concurrency through netHandover.releaseMultiPath() and unregister related listening methods.
/**
* Stop multi net path.
* */
export function releaseMultiPath() {
try {
netHandover.releaseMultiPath();
} catch (err) {
const error: BusinessError = err as BusinessError;
hilog.error(DOMAIN, TAG, `[releaseMultiPath] Error:${error.code},${error.name}`);
}
}
// ...
/**
* Stop listening on multiple network paths.
* */
export function setOffMultiPathStateChange() {
try {
netHandover.off('multiPathStateChange');
} catch (err) {
const error: BusinessError = err as BusinessError;
hilog.error(DOMAIN, TAG, `[setOffMultiPathStateChange] Error:${error.code},${error.name}`);
}
} When synchronizing data and files or downloading resources, the downloader needs to process multiple file transmission tasks. Multi-network concurrency can be used to expand network bandwidth by allocating different file transmission tasks to distinct network paths for concurrent transmission, thereby improving efficiency.
Concurrent transmission of multiple files and multipart transmission of large files share the same underlying principle for leveraging multi-network concurrency capabilities. The overall process involves obtaining multiple netHandles after enabling multi-network concurrency, creating multiple TCP sockets and binding each to a distinct netHandle, and establishing connections via these TCP sockets to initiate transmission tasks in parallel. The only difference is that multipart transmission sends file fragments over each connection, whereas multiple distinct files are transmitted in this scenario. Here, transmitting two files concurrently is used as an example.
The access and binding part of multi-network concurrency is the same as that in the multipart transmission scenario and is not detailed here. Only the code of key differences is provided.
Encapsulate a file download class, provide a file download method, create a thread based on the download object link and netId, and initiate a file download task.
/**
* Start download file.
* */
public async startDownload() {
if (this.downUrls) {
this.isFileDownloading = true;
const netId = this.netHandle ? this.netHandle.netId : -1;
const task = new taskpool.Task(getFileSizeWithNet, this.downUrls, CommonConst.HTTP_DEFAULT_PORT, netId);
try {
const fileSize = await taskpool.execute(task) as number;
if (fileSize > 0) {
// notify download start
this.onDownStart(fileSize);
this.fileChunk.endPosition = fileSize;
// start download the file using taskpool
const downTask =
new taskpool.Task(downloadFileChunkWithNet, this.downUrls, CommonConst.HTTP_DEFAULT_PORT, this.fileChunk,
netId, this.downListener);
const downRes = await taskpool.execute(downTask);
if (downRes) {
// notify download success
this.onDownSuccess();
} else {
// download failed,retry again
this.retryDownload();
}
} else {
// download failed,retry again
this.retryDownload();
hilog.error(DOMAIN, TAG, `[startDownload] upload failed`);
}
} catch (error) {
// download failed,retry again
this.retryDownload();
const err: BusinessError = error as BusinessError;
hilog.error(DOMAIN, TAG, `[startDownload] taskpool error occurred:${err.code},${err.name}`);
}
} else {
hilog.warn(DOMAIN, TAG, `[startDownload] Url is null`);
// download failed,retry again
this.onDownFailed();
}
} Download the first file using the default network and update the download progress.
/**
* Downloads the first file using the specified netHandle.
* @param netHandle The specified netHandle to access the server.
* */
private startDownFirstFile(netHandle: connection.NetHandle) {
this.firstFileDownloader = new FileDownloadManager(this.firstDownFileInfo!, netHandle);
this.firstFileDownloader.onProgress = (downloaded: number, fileSize: number, progress: number) => {
this.downFirstProgress = progress;
this.downFirstProgressText = `${formatFileSize(downloaded)} / ${formatFileSize(fileSize)}`;
}
// download success
this.firstFileDownloader.onSuccess = () => {
this.firstFileDownloading = false;
this.downBtnEnable = (!this.firstFileDownloading) && (!this.secondFileDownloading) && this.taskArray.length === 0;
this.downFirstProgressColor = $r('sys.color.confirm');
let res = this.taskArray.shift();
this.downFirstFileResult = '';
if (res) {
this.startDownSecondFile(netHandle);
} else {
hilog.info(DOMAIN, TAG, `[startDownFirstFile] File1 downloaded,no need to download File2`);
}
}
// download failed
this.firstFileDownloader.onError = () => {
this.firstFileDownloading = false;
this.downBtnEnable = (!this.firstFileDownloading) && (!this.secondFileDownloading);
if (this.downFirstProgress === 0) {
this.downFirstProgress = 0.01;
}
this.downFirstProgressColor = $r('sys.color.multi_color_08');
this.taskArray.shift();
this.downFirstFileResult = $r('app.string.down_failed');
}
// init downloading status
this.firstFileDownloading = true;
this.downFirstProgress = 0;
this.downFirstProgressColor = $r('sys.color.comp_background_emphasize');
this.downFirstFileResult = '';
// start download
this.firstFileDownloader.startDownload();
} If the multi-network concurrency request succeeds, obtain the new available NetHandle from the callback for listening for multi-network concurrency status changes and use the new NetHandle to initiate the second file download task, achieving concurrent download.
private netHandleChange: NetHandleChange = {
onMultiNetSuccess: async (netHandle: connection.NetHandle): Promise<void> => {
this.multiNetHandle = netHandle;
let res = this.taskArray.shift();
if (res) {
this.startDownSecondFile(netHandle);
} else {
hilog.info(DOMAIN, TAG, `[netHandleChange] Multi-net enable,but no need to download file2`);
}
},
onMultiNetRelease: async (netHandle: connection.NetHandle): Promise<void> => {
this.multiNetHandle = undefined;
}
}