简体   繁体   English

Windows的高性能套接字库

[英]high performance sockets library for windows

I saw a very nice library for sockets in POCO library. 我在POCO库中看到了一个非常好的套接字库。 This uses a "classic" approach that works on both linux and windows systems, mainly SELECT based approach. 这使用了在Linux和Windows系统上都可以使用的“经典”方法,主要是基于SELECT的方法。

I would like to know if there is something specific for windows that uses async IO(completion ports ?) as I want to use it on a high performance proxy/socks server. 我想知道是否有某些特定于Windows的窗口使用异步IO(完成端口?),因为我想在高性能的代理/袜子服务器上使用它。

也许Boost :: ASIO是您要找的东西?

I can propose a C library I wrote for a network game. 我可以提出我为网络游戏编写的C库。 This library was intended for high volume simultaneous short TCP connections. 该库旨在用于大量同时短TCP连接。 It uses asynchronous epoll, kqueues, IOCP or synchronous threads. 它使用异步epoll,kqueue,IOCP或同步线程。 The interface is very simple and is abstracted thru a callback in the way node.js works. 该接口非常简单,并且通过node.js工作方式中的回调进行抽象。 As an echo server, it can handle 60k requests per second. 作为回显服务器,它每秒可以处理60k个请求。 See https://github.com/freedib/gasio 参见https://github.com/freedib/gasio

As part of my open-source BadVPN software project , I have developed an event-driven (single-threaded) cross-platform network programming framework for the C language. 作为我的开源BadVPN软件项目的一部分 ,我为C语言开发了一个事件驱动(单线程)跨平台网络编程框架。 It uses epoll on Linux and IOCP on Windows. 它在Linux上使用epoll,在Windows上使用IOCP。

Some important parts: 一些重要的部分:

It makes heavy use of flow-based programming . 它大量使用了基于流的编程 For instance, BConnection, the abstraction of TCP, uses the StreamPassInterface and StreamRecvInterface general-purpose stream I/O interfaces. 例如,TCP的抽象BConnection使用StreamPassInterfaceStreamRecvInterface通用流I / O接口。 This is very useful; 这非常有用; for instance, if you need to add SSL support to you application, little more is needed than throwing a BSSLConnection object on top of BConnection. 例如,如果您需要为应用程序添加SSL支持, 则只需要在BConnection之上添加BSSLConnection对象即可。

While most of the framework is well-documented, I don't yet provide any guides on how to use it. 尽管大多数框架都有详细的文档说明,但我尚未提供有关如何使用它的任何指南。 You can use this basic program as a starting point. 您可以使用此基本程序作为起点。 While not intended for learning, the tun2socks program and especially the the accompanying smaller udpgw program might be useful. 尽管不打算学习,但tun2socks程序,尤其是随附的较小的udpgw程序可能会有用。

Since you mentioned SOCKS, in my framework I've also implemeted a very simple SOCKS5 client (no authentication etc.) which is used by tun2socks. 自从您提到SOCKS以来,在我的框架中,我还实现了一个非常简单的SOCKS5客户端 (无身份验证等),该客户端由tun2socks使用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM