函数轮询的头文件 [英] header file for the function poll

查看:88
本文介绍了函数轮询的头文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用非阻塞套接字创建聊天应用程序。为此,我应该使用poll()函数。我理解并且我必须包含poll.h头文件,但我的编译器说找不到这样的文件或目录,另一方面如果我不包含这个文件,我的代码接受结构pollfd,它编译得很好,但在运行时给我的错误是变量P未经初始化使用(我将P定义为pollfd变量)可能有人告诉我在这种情况下该怎么办...是有可能下载头文件吗?我正在开发visual studio 2008.

I am trying to create a chat application with a nonblocking socket. for this I am supposed to use the "poll()" function. I understaand that I''ve to include the "poll.h" header file but my compiler says "No such file or directory found",On the other hand If I don''t include this file my code accepts the structure pollfd,it compiles fine but at run time gives me the error that the variable "P is used without being initialised"(I defined "P" to be a pollfd variable) could some one tell me what should I do in this situation... is it possible to download header files? I am working on visual studio 2008.

推荐答案

看看这个网站: http://forums.codeguru.com/showthread.php?460259-pollfd-in-windows [ ^ ]



问:民意调查.h在Windows中不存在,因此套接字的poll()无法编译。有没有办法让它工作,或者另一种方法?



答:我的理解是poll()执行与select()相同的功能。因此,如果编写可移植代码,请坚持使用select()函数。



祝你好运!
Take a look at this site: http://forums.codeguru.com/showthread.php?460259-pollfd-in-windows[^]

Q: poll.h does not exist in windows so poll() for sockets does not compile. Is there a way to make it work, or an alternative method?

A: It''s my understanding that poll() performs the same functionality as select(). So, if writing portable code, stick to use of the select() function.

Good luck!


这篇关于函数轮询的头文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆