document.write(''); document.write(''); document.write('

当前位置 博文首页 > Go语言Echo服务器的方法

    Go语言Echo服务器的方法

    作者:不是JS 时间:2021-02-13 12:05

    本文实例讲述了Go语言Echo服务器的方法。分享给大家供大家参考。具体如下:

    复制代码 代码如下:
    package main
    import (
        "net"
        "io"
    )
    func main() {
        serv, e := net.Listen("tcp", ":12345")
        if e != nil {
            panic(e)
        }
        defer serv.Close()
        for {
            conn, ce := serv.Accept()
            if ce != nil {
                break
            }
            go func(c net.Conn) {
                io.Copy(c, c)
                c.Close()
            }(conn)
        }
    }

    希望本文所述对大家的Go语言程序设计有所帮助。

    js
    下一篇:没有了