Unresolved socket address

This is more likely a newbie, but I can't get the type of answer I'm looking for on Google.

I read the InetSocketAddress class in the java.net package and I came across this method called createUnresolved(String host, int port) . This method creates an unresolved socket.

Basically, what do we mean by unauthorized? I often came across this term with errors when compiling a program, but did not fully understand it. Can someone explain the general meaning in java and the meaning with context for the specified method.

Thanks.

+6
source share
2 answers

I found this in the sun-blog :

But I decided to keep it as it is, but use createUnresolved () to create InetSocketAddress so that we know what was used to create it. If the user first hit the IP address, we will not process it. (I think it was indistinguishable before). The icon will have anything the user (IP or name) at the beginning and if the name is used, the key to the marker cache will not change even with addr changes. So the delegate should continue to work.

Basically, this is a half-baked InetSocketAddress - so this is not the final iteration. This is an intermediate step.

And from the API:

There may also be a pair (hostname + port number), in which case an attempt will be made to resolve the hostname.

If the permission fails, the address is considered unresolved, but may still be used in some circumstances, such as connecting through a proxy

Thus, we did not find the hostname or user-friendly method "www.abc.com".

But if we connect through a proxy server, this is normal, because the proxy server processes the host name.

0
source

I had the same exception: java.net.UnknownHostException: Host is not allowed: https://www.google.com

The problem was that I added the https: // protocol, the problem was solved after removing https: //

 try { Socket socket = new Socket(); socket.connect(new InetSocketAddress("www.google.com", 443), 100); socket.close(); return true; } catch (IOException e) { e.printStackTrace(); return false; } 
0
source

All Articles