日期:2014-05-20  浏览次数:20765 次

关于socket的java.net.SocketException: select failed错误的问题
[code=Java][/code]
package test;

import java.net.*;
import java.io.*;

public class TCPServer {

  public static void main(String[] args) throws Exception {
  ServerSocket ss = new ServerSocket(6666);
  Socket s = ss.accept();
  System.out.println("a client connect!");
  }
}
这是服务器的
package test;

import java.io.*;
import java.net.*;

public class TCPClient {
public static void main(String[] args) throws Exception {
Socket s = new Socket("127.0.0.1",6666);
}
}

错误run:
Exception in thread "main" java.net.SocketException: select failed
at java.net.PlainSocketImpl.socketAccept(Native Method)
at java.net.PlainSocketImpl.accept(PlainSocketImpl.java:408)
at java.net.ServerSocket.implAccept(ServerSocket.java:462)
at java.net.ServerSocket.accept(ServerSocket.java:430)
at test.TCPServer.main(TCPServer.java:10)
Java Result: 1

我的win7系统没扣ipv6的选项的怎么出这个问题了

------解决方案--------------------
估计是客户端没发送数据,服务端就接受了?