2009年2月25日星期三

java.net.BindException: Permission denied

在运行serverSocket = new ServerSocket(port);
却报出:java.net.BindException: Permission denied错误,在网上看到一段话,解决自己的疑问
-----------------------------
In UNIX environments port numbers below 1024 are reserved and can be bound or used only by root (superuser). So if the non-root users try to run the application they will receive an error message saying that
"java.net.BindException: Permission Denied"
There are two ways to avoid this exception. One way is to login as root and run the program. The other way is to specify a port greater than 1023

没有评论: