> For the complete documentation index, see [llms.txt](https://wskdsgcf.gitbook.io/mastering-go-zh-cn/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://wskdsgcf.gitbook.io/mastering-go-zh-cn/13.0/13.1.md).

# 13.1 Go 标准库-net

在 Go 语言中，您不使用 net 包提供的功能是无法创建一个 TCP 或 UDP 的客户端或服务器的。

net.Dial() 方法作为客户端连接网络，而 net.Listen() 方法作为服务端告诉 Go 程序接收网络连接。这俩个方法只有第一个参数相同，都是网络类型。net.Dial() 和 net.Listen() 方法的返回值，是实现了 io.Reader 和 io.Writer 接口的 net.Conn 类型。
