search

Home  >  Q&A  >  body text

高并发 - C/C++ 有哪些适合快速开发的socket服务器框架?

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

伊谢尔伦伊谢尔伦2901 days ago761

reply all(7)I'll reply

  • PHP中文网

    PHP中文网2017-04-17 11:47:16

    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

    reply
    0
  • 伊谢尔伦

    伊谢尔伦2017-04-17 11:47:16

    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.

    reply
    0
  • 天蓬老师

    天蓬老师2017-04-17 11:47:16

    I suggest you take a look at golang

    reply
    0
  • 巴扎黑

    巴扎黑2017-04-17 11:47:16

    There is a c++ framework ACE

    reply
    0
  • ringa_lee

    ringa_lee2017-04-17 11:47:16

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

    reply
    0
  • 黄舟

    黄舟2017-04-17 11:47:16

    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

    reply
    0
  • PHP中文网

    PHP中文网2017-04-17 11:47:16

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

    reply
    0
  • Cancelreply