I am creating a raw socket to sniff packets on android as below.
sock_raw = socket(AF_INET , SOCK_RAW , IPPROTO_TCP);
if(sock_raw < 0)
{
fprintf(fs,"Socket Error : %d %d\n",errno, EACCES);
if( errno == EACCES )
fprintf(fs,"PERMISSIN DENIED\n");
return 1;
}
When I run the code on emulator, socket functions returns -1 and errno
has value 1 which means "Operation not permitted". But the same code
runs fine on Ubuntu 10 under sudo.
By default, I have root access in emulator using adb shell. Also, My
App has below permissions
<uses-permission android:name="android.permission.INTERNET" /
>
<uses-permission
android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission
android:name="android.permission.ACCESS_WIFI_STATE"/>
Can anyone help me to rectify this problem?
By the way, how to run an application in emulator under root?
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en