高并发 - C/C++ 有哪些适合快速开发的socket服务器框架?
伊谢尔伦
伊谢尔伦 2017-04-17 11:45:16
0
7
720

如题,设想做一个项目需要接收大量物联网硬件设备上传数据信息(当然,数据量不大,每次不超过512字节),最高同时在线5000个设备(TCP连接可双方通信收发数据),需要这么一个接收程序,该用什么框架?
见到一些做类似物联网设备的GPS系统的服务器,成千上万辆车在里面监控也很稳定,这其中要注意什么。
描述不明白的我会在下面做补充的。

伊谢尔伦
伊谢尔伦

小伙看你根骨奇佳,潜力无限,来学PHP伐。

reply all(7)
洪涛

If you are under Windows, it is recommended to learn about "IOCP". If you are under Linux, it is recommended to learn about "epoll".
If the business is not complicated and just sends and receives a large amount of data, it should be enough.
Of course, if you don’t have to use C/C++, you can try Python’s “tornado”

PS: LZ, the mainstream technology with the amount of data you mentioned can hold it

伊谢尔伦

If you have a C++ background, you can consider using Thrift. This requires the server and client to be used together.

If you only consider the server, Go and NodeJS are both good choices. It will be clearer if you look at the official examples.

As for the stability of the socket connection, it mainly depends on whether the TCP heartbeat detection and data retransmission are done well. For situations where the channel is not good, such as when using a 3G card for networking, a notification will be sent every tens of seconds. The heartbeat packet of the data ensures that the disconnection request is detected as early as possible and the connection is reconnected as soon as possible. Server-side performance should not be a big problem. Even if the device sends data every second, as long as the business is not too complex, there will be no bottlenecks.

Peter_Zhu

I suggest you take a look at golang

巴扎黑

There is a c++ framework ACE

左手右手慢动作

fastrpc is the best C++ server framework, so easy that you can get started in 5 seconds

黄舟

It would be convenient if you use golang, which is naturally high in concurrent programming. If you are familiar with C, you can consider libevent

洪涛

I saw a pretty good server framework last time. You can study NF kit on open source China

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template