问答详情
源自:3-2 编程实现基于 TCP 的 Socket 通信之服务器端

提示ServerSocket serverSocket=new ServerSocket(8888);错误错误原因如下

java.net.BindException: Address already in use: JVM_Bind
at java.net.DualStackPlainSocketImpl.bind0(Native Method)
at java.net.DualStackPlainSocketImpl.socketBind(Unknown Source)
at java.net.AbstractPlainSocketImpl.bind(Unknown Source)
at java.net.PlainSocketImpl.bind(Unknown Source)
at java.net.ServerSocket.bind(Unknown Source)
at java.net.ServerSocket.<init>(Unknown Source)
at java.net.ServerSocket.<init>(Unknown Source)
at socket.Server.main(Server.java:18)

提问者:慕雪845970 2018-06-30 22:50

个回答

  • qq_假装O坏_04309559
    2018-07-01 14:44:43

    这说明你之前已经开启了一个服务器的线程,端口号被占用了,关闭开启的服务器线程,然后重新打开就可以了