5

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();
  • possible duplicate of [What can cause “ IO error java.net.SocketException: select failed ”?](http://stackoverflow.com/questions/11926655/what-can-cause-io-error-java-net-socketexception-select-failed) – assylias Nov 17 '12 at 23:21
  • The question was never satisfactorily answered. It was not a firewall issue or admin privileges problem – iForgotMyLogin Nov 17 '12 at 23:28
  • I'm new here and unaware of his prowess, but I assume this fact should convey hopelessness – iForgotMyLogin Nov 17 '12 at 23:53
  • When you have more than 75 points of reputation, you could [put a bounty on this question](http://stackoverflow.com/faq#bounty) (it will cost you your 50 points) - it might attract more answers. – assylias Nov 19 '12 at 06:59

3 Answers3

1

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.

rekordboy
  • 146
  • 1
  • 1
  • 5
0

These problems can happen, when there's a mismatch between JVM and OS. One running 32 bit and the other running 64 bit.

Olaf Dietsche
  • 72,253
  • 8
  • 102
  • 198
  • 1
    In general, you should be able to run any Java program with a 32-bit JRE running on a 64-bit OS. And in general, you shouldn't even be able to *START* a 64-bit JVM on a 32-bit OS (it should die long before you get any networking error). But yes, I would definitely encourage running a 64-bit JRE on a 64-bit OS. – paulsm4 Nov 17 '12 at 23:29
  • Currently its running on java version 1.6.0_26 I'll try some others – iForgotMyLogin Nov 17 '12 at 23:51
0

I do not believe the problem is Java 32-bit vs. 64-bit.

The problem could be Windows 32-bit vs. Windows 64-bit, however:

ALSO:

1) Please try running with this JVM option:

  • -Djava.net.preferIPv4Stack=true

2) Please make sure you've installed the 64-bit version of Java

Community
  • 1
  • 1
paulsm4
  • 114,292
  • 17
  • 138
  • 190
  • That was an old account which I lost the password for. I've never seen anyone able to solve this yet (or have the same issue). One thing I had tried before was downgrading the version of java to a different one. It had the same problem – iForgotMyLogin Nov 17 '12 at 23:24