无法使用 ServerSocket.socketBind 分配请求的地址
当我尝试设置套接字服务器时,我收到一条错误消息:
Exception in thread "main" java.net.BindException: Cannot assign requested address: JVM_Bind
at java.net.PlainSocketImpl.socketBind(Native Method)
at java.net.PlainSocketImpl.bind(PlainSocketImpl.java:383)
at java.net.ServerSocket.bind(ServerSocket.java:328)
at java.net.ServerSocket.<init>(ServerSocket.java:194)
at java.net.ServerSocket.<init>(ServerSocket.java:106)
at socketyserver.SocketyServer.main(SocketyServer.java:12)
Java Result: 1
整个代码是最简单的,因为它可以是:
public static void main(String[] args) throws UnknownHostException, IOException
{
ServerSocket serverSocket;
serverSocket = new ServerSocket(9999);
}
我100%确定我的端口已转发,Windows防火墙已关闭。没有任何东西可以阻止端口 9999。还有什么会出错?