Socket programing Permission denied

前端 未结 3 2035
醉梦人生
醉梦人生 2020-12-17 11:03

Following code is TCP server program just send back “HELLO!!” to client.

When I run server with port 80, bind() is returned Permission denied.

P

3条回答
  •  情歌与酒
    2020-12-17 11:31

    Ports below 1024 are considered "privileged" and can only be bound to with an equally privileged user (read: root).

    Anything above and including 1024 is "free to use" by anyone.

    OT: you may know this already, but the port in your example is that for HTTP web servers. Anything listening to this port should speak HTTP, too. A simple "hello world" does not suffice. ;-)

提交回复
热议问题