selector.selectedKeys()一直报错
Set<SelectionKey> selectionKeySet = selector.selectedKeys();一直报错是怎么回事
Set<SelectionKey> selectionKeySet = selector.selectedKeys();一直报错是怎么回事
2019-08-26
我是把下载的代码直接放到Eclipseli运行的,先启动服务端没问题,再启动AClient或者BClient 报错信息:
Exception in thread "main" java.net.ConnectException: Connection refused: connect
at sun.nio.ch.Net.connect0(Native Method)
at sun.nio.ch.Net.connect(Net.java:454)
at sun.nio.ch.Net.connect(Net.java:446)
at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:648)
at java.nio.channels.SocketChannel.open(SocketChannel.java:189)
at NioClient.start(NioClient.java:23)
at AClient.main(AClient.java:7)
public static void main(String[] args)
throws IOException {
new NioClient().start("AClient"); //这行报错 第7行
}
举报