net Module

Note:

Do not import the net module by running the import net command. Otherwise, an error indicating that the net package cannot be found will be reported during compilation (error: can not find package 'net'). You are advised to import the net subpackage to use the net module.

Function Description

The net module provides capabilities related to network communication.

At the HTTP application layer, the net module supports the implementation of HTTP/1.1, HTTP/2, or WebSocket on a client or server.

At the TLS transport layer, the net module supports the encrypted network communication based on TLS 1.2 or TLS 1.3.

Package List of the net Module

The net module provides the following packages:

NameDescription
httpSupports the implementation of the HTTP/1.1, HTTP/2, and WebSocket protocols on a server or client.
tlsProvides capabilities such as creating TLS servers, performing TLS handshakes based on protocols, sending and receiving encrypted data, and restoring TLS sessions, and is used for secure encrypted network communication.