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.
我正在尝试使用非阻塞套接字创建聊天应用程序。为此,我应该使用“poll()”函数。我理解并且我要包含“poll.h”头文件但我的编译器说“没有找到这样的文件或目录”,另一方面如果我不包含这个文件,我的代码接受结构pollfd,它编译很好,但在运行时给了我一个错误,即变量“P未经初始化使用”(我将“P”定义为pollfd变量)可能有人告诉我在这种情况下该怎么办...是否有可能下载头文件?我正在开发visual studio 2008。
1 个解决方案
#1
0
According to this forum post, you can try using select() instead of poll(), which Windows does not support. You could try to download the libraries and header files that you need, but those may in turn rely on platform-dependent libraries, bringing you back to square one.
根据此论坛帖子,您可以尝试使用select()而不是poll(),Windows不支持。您可以尝试下载所需的库和头文件,但这些库可能依赖于依赖于平台的库,从而使您回到原点。
You'll want to use the Windows implementation of select(), of course. Here's the link. The header is file is Winsock2.h.
当然,您将要使用select()的Windows实现。这是链接。头文件是Winsock2.h。
#1
0
According to this forum post, you can try using select() instead of poll(), which Windows does not support. You could try to download the libraries and header files that you need, but those may in turn rely on platform-dependent libraries, bringing you back to square one.
根据此论坛帖子,您可以尝试使用select()而不是poll(),Windows不支持。您可以尝试下载所需的库和头文件,但这些库可能依赖于依赖于平台的库,从而使您回到原点。
You'll want to use the Windows implementation of select(), of course. Here's the link. The header is file is Winsock2.h.
当然,您将要使用select()的Windows实现。这是链接。头文件是Winsock2.h。