gpt4 book ai didi

go - net.Listen 和 http.ListenAndServe 功能的区别

转载 作者:数据小太阳 更新时间:2023-10-29 03:11:01 25 4
gpt4 key购买 nike

我是 Go 和网络的新手。我知道 net.Listen 和 http.ListenAndServe 都创建了一个服务器。但它们的功能有什么区别?

最佳答案

基本上,作为documentation对于 net.Listen 说:网络必须是“tcp”、“tcp4”、“tcp6”、“unix”或“unixpacket”。

虽然 http.ListenAndServe 创建了一个 HTTP 服务器。

关于go - net.Listen 和 http.ListenAndServe 功能的区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51761834/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com