Three checks:
1) Run the Server code before running the Client code.
2)instead of this Socket clientSocket = new Socket("localhost", 5000);
do
Socket clientSocket = new Socket("127.0.0.1", 5000);
3)While hitting the url don't type "https://" type "http://"
Hope above might help the beginners those who are trying to connect client and server on the same computer
For those who are trying to connect to the other server rather than local
check for firewall blocking the connection or it might the listen backlog queue is full.
Top comments (0)