[英]How to accept clients in a generic way (tcp / pipe ) with libuv?
I would like to have a generic on_connection
callback that works with any type of server stream (pipe or tcp), but to accept the connection, you should provide an initialized client... 我想有一个通用的on_connection
回调,它可以与任何类型的服务器流(管道或tcp)一起使用,但是要接受连接,您应该提供一个初始化的客户端...
However uv_stream_t
is an abstract struct. 但是uv_stream_t
是抽象结构。
Is there an official way to do that ? 有官方的方法吗? Else, can I do a switch relying on the private and undocumented uv_hundle_t.type
member ? 另外,我可以依靠私有uv_hundle_t.type
记录的uv_hundle_t.type
成员进行切换吗?
Or should I use my own way of knowing the type using the .data
pointer ? 还是我应该使用自己的方式通过.data
指针知道类型?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.