zhllxt / asio2

Header only c++ network library, based on asio,support tcp,udp,http,websocket,rpc,ssl,icmp,serial_port,socks5.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

问题不是问题

Mecanik opened this issue · comments

首先,惊人的项目! 你值得高度赞扬。

其次,正如标题所说,这与其说是问题,不如说是一个问题。 我一直在网上追逐很多东西,试图重现这样的东西:https://forum.qt.io/topic/138023/reproduce-windows-iocp-server 但是到目前为止没有成功。

你认为我可以用你的图书馆复制上述内容吗? 从您的示例的初步检查来看,这似乎是可能的。 然而,一些需要的东西对我来说仍然是个问题。

非常感谢您的帮助!

I get the feeling that you are unfamiliar with Chinese, if so, you'd better use English, because as your Chinese like this, I can't understand it even more.

Of course ,you can use this repository.

Hey, I tried! :) I have a few questions related to the link above, which I`m not sure how to solve. Do you have an email or WeChat? Happy to support $.

Cross platform - supported
High performance - i think it is
TLS/SSL like encryption - supported
Connections per IP limit (to prevent basic DDoS) - supported.
Custom protocol (with custom packet structures) - supported

Note : ip limit is supported, but not to prevent basic DDoS, you need to do it youself. and i don't think ip limit will have much effect on DDoS. Why don't try Cloudflare ?

example for the ip limit ( more details see the asio2/example/ directory ):

asio2::tcp_server server;

server.bind_accept([](std::shared_ptr<asio2::tcp_session>& session_ptr)
{
	// You can close the connection directly here.
	// Of course, you can also close the connection anywhere.
	if (session_ptr->get_remote_address() == "192.168.0.100")
		session_ptr->stop();
});

Custom protocol - If you don't know how to do it, show me your protocol, i can provide you with a sample code.

Thanks, I've already checked all the above. What I need to reproduce is similar to these:

  • Queue - not sure if needed with asio
  • Custom Protocol - Here you can see where it is called and here for packet parsing
  • Custom Encryption - Don't think it's necessary since SSL/TLS is there
  • Custom IP List - Windows offers "server accept condition" which is perfect to limit connections per IP, as seen here

That's about it really, I`m sure it can be easily reproduced with your library - I just lack the knowledge. The above is written in more C style and limited to Windows, I would like to use modern C++ style with cross platform ability.

Also have a few other questions:

  • Possible work in IOCP mode rather than async? (wait for 100% packet received)
  • How does asio handle connections, fixed threads or one thread per connection? Very important to know because imagine 10,000 connections to one app instance

That's it really, if you could give me some examples it would be awesome. I have been looking for a long time now.

Send an email to zhllxt@gmail.com with your WeChat, and I will add you.

Done, can remove.