Android ServerSocket Permission Denied

I was just trying to create a web server application and ran into this, so I thought I’d share it. I wanted to run my Android web server on port 80 (since that’s where web servers usually run), but I kept getting a BindException saying “Permission denied”. Note that ServerSocket, of course, requires android.permission.INTERNET in your manifest. After a little digging, I’ve learned that ports 1-1024 are protected and only accessible by root (pretty much eliminating them for any app that you want to make widely available, since most people don’t have rooted phones. To get around this, of course, all you have to do is use a port greater than 1024…I was just hoping to cut down on the amount of typing when connecting to my web server from a browser…oh well.

Leave a Reply

Your email address will not be published. Required fields are marked *