A particular website has 2 DNS entries, i.e. 2 IP addresses for same hostname. But, one of the IP address is not working, only 1 works.
I am trying to develop an HTTP Client without using HTTP libraries in Java. I am using Socket.connect(hostname, port) to connect to from my client to the server.
I am using InetSocketAddress to resolve the hostname. If it resolves to working IP Address my HTTP Client works fine. If the non working IP address is resolved, I get a Unknown Host Exception.
I am trying to handle this efficiently, i.e. when the non working IP address is selected, it should try to connect to another IP addresses. I am unable to achieve this. Appreciate all your help, thanks in advance.