Search code examples
androidsocketsandroid-networking

java.net.BindException: bind failed: EACCES (Permission denied) on a rooted device


The following code throws "java.net.BindException: bind failed: EACCES (Permission denied)" on a rooted tablet:

 DatagramSocket ds = new DatagramSocket(67);

I thought binding to privileged port 67 was allowed on a rooted device. Could anyone shed some light on this?


Solution

  • Just because a device is "rooted", that does not give permission to arbitrary apps to do anything they want with root privileges. Rooted devices merely allow arbitrary apps to request to use the su command line to execute new processes with root privileges via a command line.

    See this, for example.