Faster and safest internet with hQuic Part-1

Overview

QUIC (Quick UDP Internet Connections) is a general-purpose transport layer network protocol.

QUIC is a new transport which reduces latency compared to that of TCP. On the surface, QUIC is very similar to TCP+TLS+HTTP/2 implemented on UDP. Because TCP is implemented in operating system kernels, and middlebox firmware, making significant changes to TCP is next to impossible.

QUIC reduces round trips by working with UDP. With great features like eliminating head of line blocking, loss recovery over UDP by using multiplexed connections and congestion control, the protocol has evolved and is being widely used.

Introduction of hQUIC

hQUIC provides the ability to fulfil our needs for lower packet loss in our applications, high performance in our network operations and reliable fast connection. It supports the gQUIC protocol and provides intelligent congestion control algorithms to avoid congestions in different network environments.

Advantages

Ease of use: Streamlines APIs and shields low-level network details.

High compatibility: Supports gQUIC and Cronet.

Better experience: Outperforms other protocols in poor network conditions

hQuic

What is Cronet?

Cronet is the networking stack of Chromium put into a library for use on mobile. This is the same networking stack that is used in the Chrome browser by over a billion people. It offers an easy-to-use, high performance, standards-compliant, and secure way to perform HTTP requests.

Cronet is a very well implemented and tested network stack that provides almost everything that a standard app needs from a network layer library, things like DNS, Cookies, SSL/TLS, HTTP(S), HTTP2, Proxy/PAC, OSCP, Web sockets, and F̶T̶P̶(soon to be removed). It also supports HTTP over QUIC, soon to be called HTTP3. This makes it a very attractive library to use as the network layer for your mobile app.

How TCP Works?

TCP allows for the transmission of information in both directions. This means that computer systems that communicate over TCP can send and receive data at the same time, similar to a telephone conversation. The protocol uses segments (packets) as the basic units of data transmission.

The actual process for establishing a connection with the TCP protocol is as follows:

1. First, the requesting sender sends the server a SYN packet or segment (SYN stands for synchronize) with a unique, random number. This number ensures full transmission in the correct order (without duplicates).

2. If the receiver has received the segment, it agrees to the connection by returning a SYN-ACK packet (ACK stands for acknowledgement) including the client’s sequence number plus 1. It also transmits its own sequence number to the client.

3. Finally, the sender acknowledges the receipt of the SYN-ACK segment by sending its own ACK packet, which in this case contains the receiver’s sequence number plus 1. At the same time, the client can already begin transferring data to the receiver.

Prerequisite

1. A computer with Android Studio installed and able to access the Internet

2. A Huawei phone with HMS Core (APK) 5.0.0 or later installed for debugging the app

3. Java JDK (1.7 or later)

4. Android API (level 19 or higher)

5. EMUI 3.0 or later

6. HMS Core (APK) 5.0.0 or later

Integration process

  1. Open the build.gradle file in the root directory of your Android Studio project.

2. Open the build.gradle file in the app directory and add dependency on the SDK.

3. Initialise the service

4. Initialise the Cronet Engine

App Development

I will use APIs of the hQUIC SDK by developing a Speed Test app step by step.

I have created HQUICSericeProvider class in which I will create the service using hQuic APIs.

Let us implements the asynchronous initialization API.

I have tested this service inside the HQUICActivity which test the speed of network call based on QUIC website.

Result

Let us launch our application

Conclusion

In this article, We have learned how to integrate hQuic in Speed test application.

With Huawei’s intelligent congestion control algorithm to connect your apps faster and avoid packet loss.

If you have any doubts or queries. Please leave your valuable comment in the comment section and do not forget to like and follow me.

References

https://developer.huawei.com/consumer/en/doc/development/HMSCore-Guides/introduction-0000001050440045

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store