Rohan Tadphale wrote:
***********CONSOLE MSG
***after runnning server side code
java.net.BindException: Address already in use: JVM_Bind
at java.net.DualStackPlainSocketImpl.bind0(Native Method)
at java.net.DualStackPlainSocketImpl.socketBind(DualStackPlainSocketImpl.java:106)
at java.net.AbstractPlainSocketImpl.bind(AbstractPlainSocketImpl.java:376)
at java.net.PlainSocketImpl.bind(PlainSocketImpl.java:190)
at java.net.ServerSocket.bind(ServerSocket.java:376)
at java.net.ServerSocket.<init>(ServerSocket.java:237)
at tcp.ChatServer.<init>(ChatServer.java:22)
at tcp.ChatServer.main(ChatServer.java:63)
java.lang.NullPointerException
at tcp.ChatServer.talk(ChatServer.java:51)
at tcp.ChatServer.main(ChatServer.java:64)
An address already in use means that the server socket could not be created because the port is already in use...
From your code, it looks like you are trying to use port 2000... and some other program is already using that port. The answer is simple, find a free port to use. Or if that is the port assigned to your program, find out who is using it, and get them to stop their program.
Henry