How do I open a socket below 1024
<p>I'm trying to create a ServerSocket on a port below 1024.</p>

<p>Obviously, this is restricted to root access only. </p>

<p>But I'm struggling on getting the right permissions for my app.</p>

<p>I'm using this code, for example, to test if I have root access (or trigger the dialog)</p>

<p>But it still doesn't let me ServerSocket work.</p>

<p>AFAIK, the process that is created with the SU command has the root access, not my app. How do I get root access into my own process?</p>

<pre><code>public stat

ic boolean getRoot() {
        try {
            Process p = Runtime.getRuntime().exec("su");
            DataOutputStream os = new DataOutputStream(p.getOutputStream());
            os.writeBytes("echo \"Do I have root?\" &gt;/system/sd/temporary.txt\n");
            os.writeBytes("exit\n");
            os.flush();
            try {
                p.waitFor();
                if (p.exitValue() != 255) {
                    return true;
                } else {
                    return false;
                }
            } catch (InterruptedException e) {
                e.printStackTrace();
                return false;
            }
        } catch (IOException e) {
            e.printStackTrace();
            return false;
        }
    }
</code></pre>
