Go语言学习之net包(The way to go)

ゝ一纸荒年。 2022-06-17 01:47 259阅读 0赞

生命不止,继续go go go!!!

不要问我net包和net/http包的区别,我们先会用,两者的区别慢慢去体会。

net包有什么作用?

Package net provides a portable interface for network I/O, including TCP/IP, UDP, domain name resolution, and Unix domain sockets.

Although the package provides access to low-level networking primitives, most clients will need only the basic interface provided by the Dial, Listen, and Accept functions and the associated Conn and Listener interfaces.

下面介绍几个方法

Dial
语法:

  1. func Dial(network, address string) (Conn, error)

作用:Dial connects to the address on the named network.
例子:

  1. Dial("tcp",

发表评论

表情:
评论列表 (有 0 条评论,259人围观)

还没有评论,来说两句吧...

相关阅读