最近跟着尚学堂的视频做一个在线聊天系统
代码没错 可一run就出错
找不出错哪儿了
import java.io.IOException;
import java.net.*;
public class f {
public static void main(String[] args) {
try {
ServerSocket ss = new ServerSocket (8888);
while(true) {
Socket s = ss.accept();
System.out.println("a client connected!");
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
下面是报的错
java.net.BindException: Address already in use: JVM_Bind
at java.net.PlainSocketImpl.socketBind(Native Method)
at java.net.PlainSocketImpl.bind(PlainSocketImpl.java:359)
at java.net.ServerSocket.bind(ServerSocket.java:319)
at java.net.ServerSocket.<init>(ServerSocket.java:185)
at java.net.ServerSocket.<init>(ServerSocket.java:97)
at ChatServer.main(ChatServer.java:8)
编译时没错 运行时错误就报啦