porting ioctl() calls from unix to linux, error with FIONBIO

前端 未结 1 1777
醉梦人生
醉梦人生 2021-01-19 10:20

i want to use ioctl() to get the number of bytes ready to be read

the way I did it is:

mysocket=socket(....);
ioctl(mysocket, FIONBIO, &zero);            


        
相关标签:
1条回答
  • 2021-01-19 11:16

    Have you tried including sys/ioctl.h?

    This code works for me:

    #include <sys/ioctl.h>
    #include <stdio.h>
    
    int main() {
        printf("FIONBIO value %d\n", FIONBIO);
    }
    

    When I execute grep -R FIONBIO /usr/include, it's found here:

    /usr/include/asm-generic/ioctls.h:#define FIONBIO 0x5421
    
    0 讨论(0)
提交回复
热议问题