将 SSL 添加到基于 IOCP 的 Windows 服务器的最简单方法?
我有一个基于 IOCP 的服务器,我们已经使用了很长时间。现在我们需要为此添加 SSL 支持。我正在努力寻找一个干净的解决方案。我发现其他两个线程中建议的两个选项 -
1)使用 openssl Memory BIO - 但在网上没有找到任何与 IOCP 端口一起使用的示例,这些示例解释了由于 IOCP 的多线程性质而出现的问题。 2)将Boost ASIO与ssl一起使用——我认为它在内部使用了IOCP。但是没有示例说明如何存储每个连接的状态数据 - 例如,在我们的服务器中,为每个连接的客户端存储了状态信息,该状态信息用于识别客户端并相应地解析客户端发送的数据。
如果您能为上述两个问题提出解决方案或任何其他对您有用的解决方案,我将不胜感激。
更新:我正在使用 Simple C 在 Winsock2 库中实现 IOCP。
此致 尼拉德里
I have a IOCP based server which we have used for long time. Now we need to add SSL support to this. I am struggling to find a clean solution. I have found two options suggested in the other two threads -
1) Use openssl Memory BIO - but have not found any examples on the net that work with IOCP ports which explain the issues that will arrise due to the multi threaded nature of IOCP.
2) Use Boost ASIO with ssl - which i think uses IOCP internally. But there are no examples that show how per connection state data can be stored - for example in our server there is state information stored for each client that is connected , this state information is used to recognise the client and parse sent by client data accordingly.
I would be really grateful if you could suggest a solution to the above two problems or any other solution that has worked for you.
UPDATE : I am using Simple C to implement IOCP in winsock2 library.
Best Regards
Niladri
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
请在此处查看我的答案:如何将 OpenSSL 与 WinSock 一起使用?< /a>
我写了一篇文章,其中包含将 OpenSSL 与异步套接字结合使用的代码。本文的代码显示了 MFC 的异步套接字,但 IOCP 的理论是相同的。
我使用了文章中介绍的设计的变体来支持 OpenSSL,该支持可作为我的基于 IOCP 的服务器框架的一部分使用;请参阅此处: http://www.serverframework.com /products---the-ssltls-using-openssl-option.html。
See my answer here: How do I use OpenSSL with WinSock?
I wrote an article which has code for using OpenSSL with async sockets. The article's code shows MFC's async sockets but the theory is the same for IOCP.
I used a variation on the design presented in the article for the OpenSSL support that's available as part of my IOCP based server framework; see here: http://www.serverframework.com/products---the-ssltls-using-openssl-option.html.