proxytoworld
V2EX  ›  问与答

怎么用 go 维护一堆 TCP 连接,必要时可以针对单个连接进行指定动作(读/写)

  •  
  •   proxytoworld · Mar 17, 2022 · 1689 views
    This topic created in 1696 days ago, the information mentioned may be changed or developed.
    如题,用什么结构比较好
    4 replies  •  2022-03-18 15:42:31 +08:00
    fgwmlhdkkkw
    fgwmlhdkkkw
    Mar 17, 2022
    1
    用筷子怎么吃面条?
    MidGap
    MidGap
    Mar 17, 2022
    2
    搞个 map 存 ip:port 呗 不就是长连接吗
    sunny352787
    sunny352787
    Mar 17, 2022
    3
    emmm...服务的标准做法是一个连接一个 goroutine ,非标准的建议用 nbio 、gnet 这类高性能网络库
    你大概是要这种答案吧?
    Johngodme
    Johngodme
    Mar 18, 2022
    4
    net.TCPConn 来做
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   1526 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 35ms · UTC 06:57 · PVG 14:57 · LAX 22:57 · JFK 01:57
    ♥ Do have faith in what you're doing.