douzai1074 2018-07-08 17:59
浏览 113

在Golang中实现TCP状态服务器的正确方法

I believe this has been asked before but never found anything related to stateful connections, So here it goes.

I'm writting a server in golang where users connect and login to ask for specific date later on. My problem here is that doing my research I came up with a method of archiving this over a tcp connection (lets remember it's stateful) creating a goroutine every connection and keeping it listening to the user income like this example: https://github.com/firstrow/tcp_server/blob/master/tcp_server.go My doubts with this method are related with the idea of keeping a goroutine openned for every connected user.

I would like to know if this is the correct approach or if there is another method to archieve that like keeping a less amount of routines listning for new incomes.

Thanks

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥20 delta降尺度方法,未来数据怎么降尺度
    • ¥15 c# 使用NPOI快速将datatable数据导入excel中指定sheet,要求快速高效
    • ¥15 高德地图点聚合中Marker的位置无法实时更新
    • ¥15 DIFY API Endpoint 问题。
    • ¥20 sub地址DHCP问题
    • ¥15 delta降尺度计算的一些细节,有偿
    • ¥15 Arduino红外遥控代码有问题
    • ¥15 数值计算离散正交多项式
    • ¥30 数值计算均差系数编程
    • ¥15 redis-full-check比较 两个集群的数据出错