Socket I/O模式 epoll、重叠I/O

发布于 2024-10-26 03:23:47 字数 299 浏览 4 评论 0原文

我正在工作的客户端服务器应用程序,我需要管理多个套接字连接 1000+。

通过探索,我发现重叠 I/O 或完成端口很适合在 Windows 中对多个套接字进行多路分解,而 epoll 在 Linux 上也很不错。

  1. epoll 与 Windows 中的 Overlapped I/O 或 Completion Port 不同吗?
  2. 我想使用 boost,因为它可以在 Windows 和 Linux 上运行。

是否可以使用 boost 来实现这些技术(epoll 和重叠 I/O 或完成端口)?

I am working client server application where I need to manage multiple socket connection 1000+.

By exploration I found out the Overlapped I/O or Completion Port is nice to do de-multiplexing multiple socket in Windows and epoll is nice on Linux.

  1. Is epoll is different from Overlapped I/O or Completion Port in windows.
  2. I wanted to use boost since it works on both windows and Linux.

Is it possible to implement these techniques (epoll and Overlapped I/O or Completion Port) using boost?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

╰ゝ天使的微笑 2024-11-02 03:23:47

Linux 上的 epoll 实现和 Windows 上的 I/O 完成端口是不同的,但是 Boost.Asio 很好地消除了应用程序的差异。这是 io_service 的全部要点 反应器队列

Windows NT、2000、XP、2003和Vista

解复用机制:

  • 使用重叠的I/O和I/O
    所有异步的完成端口
    套接字操作除了
    异步连接。
  • 使用 select 来模拟异步连接。

Linux Kernel 2.6

解复用机制:

  • 使用epoll进行解复用。

The implementation of epoll on Linux and I/O completion ports on Windows are different, however Boost.Asio nicely abstracts away the differences for your application. This is the whole point of the io_service reactor queue:

Windows NT, 2000, XP, 2003 and Vista

Demultiplexing mechanism:

  • Uses overlapped I/O and I/O
    completion ports for all asynchronous
    socket operations except for
    asynchronous connect.
  • Uses select for emulating asynchronous connect.

Linux Kernel 2.6

Demultiplexing mechanism:

  • Uses epoll for demultiplexing.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文