I get this strange exception on only when running on 64 bit (windows 7 ultimate) Not when running 32 bit win7 ultimate. Currently its running on java version 1.6.0_26
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)
Here is the code:
//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();
}
}
}
The error referenced on line at points to this bit:
Socket newsock = sock.accept();
You could definitely have an issue with windows 7 and the version of Java SDK you have installed. Download and install the latest version of Java SDK 7 from the oracle website. See if that helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With