我得到這個奇怪的例外,只有當運行在64位(Windows 7的最終)不是當運行32位win7最終。目前其對Java版本1.6.0_26Java服務器工作在32位而不是64位。爲什麼?
running server!
java.net.SocketException: select failed
at java.net.PlainSocketImpl.socketAccept(Native Method)
at java.net.PlainSocketImpl.accept(Unknown Source)
at java.net.ServerSocket.implAccept(Unknown Source)
at java.net.ServerSocket.accept(Unknown Source)
at Server.main(Server.java:18)
跑這裏是代碼:
//import java.net.ServerSocket;
//import java.net.Socket;
import java.io.*;
import java.net.*;
public class Server {
public static void main(String[] args) {
System.out.println("running server!");
int nreq = 1;
try{
ServerSocket sock = new ServerSocket(7337);
for(;;){
Socket newsock = sock.accept();
System.out.println("Creating thread...");
Thread t = new ThreadHandler(newsock, nreq);
t.start();
nreq++;
}
}
catch(Exception e)
{
e.printStackTrace();
}
}
}
在點線參考此位的錯誤:
Socket newsock = sock.accept();
可能重複[哪些原因會導致「IO錯誤java.net.SocketException異常:選擇失敗「?](http://stackoverflow.com/questions/11926655/what-can-cause-io-error-java-net-socketexception-select-failed) – assylias
這個問題從來沒有令人滿意的答案。這不是防火牆問題或管理員權限問題 – iForgotMyLogin
我是新來的,不知道他的威力,但我認爲這個事實應該傳達絕望 – iForgotMyLogin