简体   繁体   English

在命名管道上选择

[英]Select on a named pipe

Is there a way to do a select() on a named pipe in win32? 有没有办法在win32中对命名管道执行select()? I want to have it block on the ReadFile call, but for only a few seconds, then if no data was received do some other work. 我想让它在ReadFile调用上阻塞,但是只有几秒钟,如果没有收到任何数据那么做其他工作。

You cannot use select() on a named pipe in win32. 您不能在win32中的命名管道上使用select()。 For emulating select like functionality for named pipes, you can use the named pipe APIs using the overlapped I/O model and WaitForMultipleObjects(). 要为命名管道模拟选择类似功能,可以使用重叠I / O模型和WaitForMultipleObjects()来使用命名管道API。

Click here for an example in MSDN for the same 单击此处获取MSDN中的示例

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

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