| View previous topic :: View next topic |
| Author |
Message |
TheEye
Joined: 19 Dec 2007 Posts: 2
|
Posted: Wed Dec 19, 2007 1:08 am Post subject: ioctl missing? |
|
|
Hello,
I was trying to determine the amount of data available on a socket using the following standard code:
"
ioctl(sock, FIONREAD, &num);
"
The ioctl function does not seem to be implemented as I get the following errors which I do not seem to be able to fix:
"
error: 'FIONREAD' was not declared in this scope
'ioctl' was not declared in this scope
"
I have the following includes:
"
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <sys/ioctl.h>
#include <netdb.h>
#include <unistd.h>
#include <errno.h>
#include <fcntl.h>
#include <sys/select.h>
"
Anyone have a solution or pointer to what I`m doing wrong? |
|
| Back to top |
|
 |
jimparis
Joined: 10 Jun 2005 Posts: 1179 Location: Boston
|
Posted: Wed Dec 19, 2007 3:29 am Post subject: |
|
|
Standard code? FIONREAD isn't even in POSIX. The PSP isn't POSIX, and definitely isn't UNIX. You'll have to figure out the Sony way of doing that. There might be some sceIoIoctl equivalent, but you'll have to resort to reverse engineering to figure it out.
An easier bet would be to just read all the available data and then you'll know exactly how much there was. |
|
| Back to top |
|
 |
TheEye
Joined: 19 Dec 2007 Posts: 2
|
Posted: Thu Dec 20, 2007 12:10 am Post subject: |
|
|
The problem is that we would like to know the available data beforehand.
Does anyone have a list of known commands for the sceIoIoctl call? |
|
| Back to top |
|
 |
jimparis
Joined: 10 Jun 2005 Posts: 1179 Location: Boston
|
Posted: Thu Dec 20, 2007 8:01 am Post subject: |
|
|
| Just read all the data and buffer it yourself. Then you can always check to see how much data is in your buffer and still only use as much as you'd like. It shouldn't be hard to rework your code to not need FIONREAD. |
|
| Back to top |
|
 |
|