I want to use ioctl () to get the number of bytes ready to read
how i did it:
mysocket=socket(....); ioctl(mysocket, FIONBIO, &zero); connect(.....); ioctl( mysocket, FIONREAD, &numBytes ); read(mysocket, buffer, numBytes);
this works fine on unix, now i need to port it to linux i keep getting error
error: "FIONBIO" was not declared in this area
Is there any header file for linux? or does "FIOBIO" not work at all on Linux?
I have the following headers:
#include <cstring> #include <sys/socket.h> #include <stropts.h> #include <fcntl.h> #include <stddef.h> #include <sys/un.h> #include <sys/types.h> #include <stdlib.h> #include <sys/ioctl.h> #include <netinet/in.h> #include <arpa/inet.h> #include <unistd.h> #include <sys/select.h> #include <fstream>
and I deleted
#include <sys/filio.h>
since he was throwing errors saying that sys / filio.h was not found
source share