Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

unresolved socket address

This is more of a novice question, but I am unable to get the type of answer I am looking for on Google.

I was reading the InetSocketAddress class in java.net package and I came across this method named createUnresolved(String host, int port). This method creates an unresolved Socket.

Basically what do we mean by unresolved ? I have come across this term often in errors while compiling a program but never have understood it completely. Can anyone please explain the general meaning in java, and meaning with context to the said method.

Thanks.

like image 822
Rajat Avatar asked Feb 02 '13 20:02

Rajat


People also ask

What is unresolved socket address?

It's an intermediary step.. And From API: It can also be a pair (hostname + port number), in which case an attempt will be made to resolve the hostname. If resolution fails then the address is said to be unresolved but can still be used on some circumstances like connecting through a proxy.

What is socket address in Java?

Class SocketAddress As an abstract class, it is meant to be subclassed with a specific, protocol dependent, implementation. It provides an immutable object used by sockets for binding, connecting, or as returned values. Since: 1.4 See Also: Socket , ServerSocket , Serialized Form.

What is socket address?

A socket address is defined by the IP address of the socket and the port number allocated to the socket.


1 Answers

I found this in a sun-blog:

But decided to keep it as is but use createUnresolved() to create an InetSocketAddress, so that we know what was used to instantiate it. If the user slapped in an IP address to begin with, we won't handle it. (I think it was indistinguishable before) The token will have whatever the user used (IP or name) in the beginning and in case of using name, the key to the token cache won't change even with addr changes. So the delegation token should continue to work.

Basically, it's a half-baked InetSocketAddress - so it's not the final iteration. It's an intermediary step..

And From API:

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

If resolution fails then the address is said to be unresolved but can still be used on some circumstances like connecting through a proxy

So we didn't find the hostname, or the user-friendly "www.abc.com" method.

But if we are connecting via a proxy it's OK because that the proxy server handles the hostname .

like image 59
Caffeinated Avatar answered Oct 21 '22 19:10

Caffeinated