Socket ports below 1024 require the ROOT user id in order to establish
a server. If you're building an application intended to go on random
devices, you're not going to have any success opening a server on port
80. This is not an Android constraint, it's the way sockets have been
in *nix for a very long time (if not always). It's a security issue to
prevent malicious applications from spoofing a service on a machine
that doesn't already provide the service.
On Jun 4, 1:32 am, Alex Xin <xinxi...@gmail.com> wrote:
> Hi, guys
> I'm new to Android development, now I'm working on a simple HTTP server
> project. I try to use ServerSocket to listen on port 80 but I failed. There
> will have an exception if I did this. I have already set INTERNET premission
> in manifest.
> I found that everything is Okay if I use port 8080, that's strange for me,
> why I cannot use port 80? I don't want my users to use another port to
> connect my server.
> Thanks very much
> Alex