“interface”一词在Go语言的net包中的含义是什么?

huangapple go评论64阅读模式
英文:

What does the word "interface" mean as used in the net package in Go

问题

net提供了一个可移植的网络I/O接口,包括TCP/IP、UDP、域名解析和Unix域套接字。

这里提到的“接口”,是指它提供了用于执行I/O操作和上述其他操作的有用函数,还是指其他什么?因为当我开始学习Go编程语言时,有人告诉我interface是Go内置的一种类型,允许我们执行多态操作,所以我不太理解上述语句中的用法。

我感觉我在脑子里把事情搞混了,因为我刚开始学习Go。

英文:

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

The "interface" used here, does it mean that it provides useful functions for preforming I/O operations and the many more operations listed above or something else? Because when I began learning Go programming language I was told that interface is a type built into Go that allows us to perform polymorphism, so I don't understand the way it's used in the statement above.

I feel like I am mixing things in my head as I just started learning Go.

答案1

得分: 1

我认为我已经从gophers社区得到了问题的答案,我要感谢大家。

net包提供了一个有用的接口,它提供了一些有用的函数(API)来执行特定的网络I/O操作,包括TCP/IP、UDP、域名解析和Unix域套接字。

它提供了一些函数,使网络操作之间能够进行一定程度的通信。

英文:

I think I have been to get the answer to the question from the gophers community I say thanks guys.

net package provides useful interface that is it provides useful functions(API) to perform certain operation network I/O, including TCP/IP, UDP, domain name resolution, and Unix domain sockets.

it provides functions that enable some level of communication between network operations.

huangapple
  • 本文由 发表于 2022年6月12日 23:40:02
  • 转载请务必保留本文链接:https://go.coder-hub.com/72593649.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定